@firestartr/cli 2.10.0-snapshot-fix-renderer-nondeterminism-2 → 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
|
@@ -320839,18 +320839,23 @@ async function freeSlot() {
|
|
|
320839
320839
|
*
|
|
320840
320840
|
*/
|
|
320841
320841
|
async function crawlDirectory(dirEnt, exec) {
|
|
320842
|
-
|
|
320843
|
-
|
|
320844
|
-
|
|
320845
|
-
|
|
320846
|
-
const
|
|
320847
|
-
|
|
320848
|
-
|
|
320849
|
-
|
|
320850
|
-
|
|
320851
|
-
|
|
320842
|
+
try {
|
|
320843
|
+
const entries = (await promises_.readdir(dirEnt))
|
|
320844
|
+
.map((entry) => external_path_.join(dirEnt, entry))
|
|
320845
|
+
.sort();
|
|
320846
|
+
for (const entry of entries) {
|
|
320847
|
+
const testDir = await isDir(entry);
|
|
320848
|
+
if (testDir) {
|
|
320849
|
+
await crawlDirectory(entry, exec);
|
|
320850
|
+
}
|
|
320851
|
+
else {
|
|
320852
|
+
await slurpFile(entry, exec);
|
|
320853
|
+
}
|
|
320852
320854
|
}
|
|
320853
320855
|
}
|
|
320856
|
+
catch (err) {
|
|
320857
|
+
throw `crawlDirectory: ${err} on ${dirEnt}`;
|
|
320858
|
+
}
|
|
320854
320859
|
}
|
|
320855
320860
|
function isDir(dirEnt) {
|
|
320856
320861
|
return promises_.stat(dirEnt)
|
|
@@ -324830,6 +324835,15 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
|
|
|
324830
324835
|
},
|
|
324831
324836
|
},
|
|
324832
324837
|
},
|
|
324838
|
+
meta: {
|
|
324839
|
+
type: 'object',
|
|
324840
|
+
additionalProperties: false,
|
|
324841
|
+
properties: {
|
|
324842
|
+
allow_non_anchored_paths: {
|
|
324843
|
+
type: 'boolean',
|
|
324844
|
+
},
|
|
324845
|
+
},
|
|
324846
|
+
},
|
|
324833
324847
|
},
|
|
324834
324848
|
required: ['args', 'feature_name', 'files', 'patches'],
|
|
324835
324849
|
title: 'root',
|
|
@@ -324953,12 +324967,23 @@ function __validateFeatureConfigData(configData) {
|
|
|
324953
324967
|
const ajv = new (ajv_default())({
|
|
324954
324968
|
allowUnionTypes: true,
|
|
324955
324969
|
});
|
|
324956
|
-
const
|
|
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);
|
|
324957
324975
|
const valid = validate(configData);
|
|
324958
324976
|
if (!valid) {
|
|
324959
324977
|
throw `Feature: config.yaml invalid ${JSON.stringify(validate.errors)}`;
|
|
324960
324978
|
}
|
|
324961
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
|
+
}
|
|
324962
324987
|
function __validateJsonPatches(configData) {
|
|
324963
324988
|
const keys = Object.keys(configData.patches);
|
|
324964
324989
|
for (const key of keys) {
|
|
@@ -325794,12 +325819,19 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
|
|
|
325794
325819
|
if ('filesTemplates' in context.config) {
|
|
325795
325820
|
expandFiles(featurePath, configData, context);
|
|
325796
325821
|
}
|
|
325822
|
+
const allowNonAnchoredPaths = allowsNonAnchoredPaths(configData);
|
|
325797
325823
|
for (const file of context.config.files) {
|
|
325798
325824
|
const { src, dest } = file;
|
|
325799
|
-
|
|
325800
|
-
|
|
325801
|
-
|
|
325802
|
-
|
|
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
|
+
}
|
|
325803
325835
|
}
|
|
325804
325836
|
const output = { files: [] };
|
|
325805
325837
|
context.config.files.forEach((file) => {
|
|
@@ -325878,14 +325910,17 @@ function buildTemplateArgs(args, context) {
|
|
|
325878
325910
|
}
|
|
325879
325911
|
function expandFiles(featurePath, configData, context) {
|
|
325880
325912
|
let files = [];
|
|
325913
|
+
const allowNonAnchoredPaths = allowsNonAnchoredPaths(configData);
|
|
325881
325914
|
for (const tpl of configData.filesTemplates) {
|
|
325882
|
-
const addToFiles = expandFilesTemplate(featurePath, tpl, context);
|
|
325915
|
+
const addToFiles = expandFilesTemplate(featurePath, tpl, context, allowNonAnchoredPaths);
|
|
325883
325916
|
files = files.concat(addToFiles).flat(Infinity);
|
|
325884
325917
|
}
|
|
325885
325918
|
context.config.files = context.config.files.concat(files).flat(Infinity);
|
|
325886
325919
|
}
|
|
325887
|
-
function expandFilesTemplate(featurePath, tplPath, context) {
|
|
325888
|
-
const templatePath =
|
|
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');
|
|
325889
325924
|
src_logger.debug(`Expanding files section with template located at ${templatePath}`);
|
|
325890
325925
|
let template;
|
|
325891
325926
|
try {
|
|
@@ -325954,6 +325989,9 @@ function resolveInside(basePath, candidate, what, baseLabel) {
|
|
|
325954
325989
|
}
|
|
325955
325990
|
return target;
|
|
325956
325991
|
}
|
|
325992
|
+
function allowsNonAnchoredPaths(configData) {
|
|
325993
|
+
return configData?.meta?.allow_non_anchored_paths === true;
|
|
325994
|
+
}
|
|
325957
325995
|
|
|
325958
325996
|
// EXTERNAL MODULE: external "node:fs"
|
|
325959
325997
|
var external_node_fs_ = __nccwpck_require__(87561);
|
|
@@ -524895,9 +524933,9 @@ const crsStatusSubcommand = {
|
|
|
524895
524933
|
};
|
|
524896
524934
|
|
|
524897
524935
|
;// CONCATENATED MODULE: ./package.json
|
|
524898
|
-
const package_namespaceObject =
|
|
524936
|
+
const package_namespaceObject = {"i8":"2.10.0"};
|
|
524899
524937
|
;// CONCATENATED MODULE: ../../package.json
|
|
524900
|
-
const package_namespaceObject_1 = {"i8":"2.
|
|
524938
|
+
const package_namespaceObject_1 = {"i8":"2.10.0"};
|
|
524901
524939
|
// EXTERNAL MODULE: ../../node_modules/semver/index.js
|
|
524902
524940
|
var semver = __nccwpck_require__(77546);
|
|
524903
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;
|