151 lines
5.7 KiB
JavaScript
151 lines
5.7 KiB
JavaScript
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
var component_exports = {};
|
|
__export(component_exports, {
|
|
AssetsSchema: () => AssetsSchema,
|
|
AuthorSchema: () => AuthorSchema,
|
|
ComponentConfigSchema: () => ComponentConfigSchema,
|
|
ContentSchema: () => ContentSchema,
|
|
ProductionSchema: () => ProductionSchema,
|
|
get: () => get
|
|
});
|
|
module.exports = __toCommonJS(component_exports);
|
|
var path = __toESM(require("path"), 1);
|
|
var import_zod = require("zod");
|
|
var import_filter = require("./filter.js");
|
|
var import_glob = require("./fs/_glob.js");
|
|
var import_variables = require("./variables.js");
|
|
var import_config = require("./config.js");
|
|
const AuthorSchema = import_zod.z.object({
|
|
name: import_zod.z.string(),
|
|
url: import_zod.z.string()
|
|
});
|
|
const ContentSchema = import_zod.z.object({
|
|
body: import_zod.z.string().optional(),
|
|
features: import_zod.z.string().optional(),
|
|
highlights: import_zod.z.string().optional(),
|
|
specs: import_zod.z.string().optional(),
|
|
license: import_zod.z.string().optional()
|
|
});
|
|
const AssetsSchema = import_zod.z.object({
|
|
gallery: import_zod.z.array(import_zod.z.string()).optional(),
|
|
renderings: import_zod.z.array(import_zod.z.string()).optional(),
|
|
components: import_zod.z.array(import_zod.z.string()).optional()
|
|
});
|
|
const ProductionSchema = import_zod.z.object({
|
|
"fusion-folder": import_zod.z.string(),
|
|
"nc-folder": import_zod.z.string(),
|
|
cam: import_zod.z.array(AuthorSchema)
|
|
});
|
|
const ComponentConfigSchema = import_zod.z.object({
|
|
// shop
|
|
cart_id: import_zod.z.string().optional(),
|
|
code: import_zod.z.string(),
|
|
price: import_zod.z.number().optional(),
|
|
cscartCats: import_zod.z.array(import_zod.z.number()).optional(),
|
|
cscartId: import_zod.z.number().optional(),
|
|
vendorId: import_zod.z.number().optional(),
|
|
//internal
|
|
version: import_zod.z.string().optional(),
|
|
status: import_zod.z.string().optional(),
|
|
authors: import_zod.z.array(AuthorSchema).optional(),
|
|
replaced_by: import_zod.z.string().optional(),
|
|
alternatives: import_zod.z.array(import_zod.z.string()).optional(),
|
|
flags: import_zod.z.number().optional(),
|
|
// public
|
|
download: import_zod.z.boolean().optional(),
|
|
name: import_zod.z.string(),
|
|
edrawings: import_zod.z.string().optional(),
|
|
showDimensions: import_zod.z.boolean().optional(),
|
|
showParts: import_zod.z.boolean().optional(),
|
|
slug: import_zod.z.string(),
|
|
score: import_zod.z.number().optional(),
|
|
Preview3d: import_zod.z.boolean().optional(),
|
|
keywords: import_zod.z.string().optional(),
|
|
meta_keywords: import_zod.z.string().optional(),
|
|
content: ContentSchema.optional(),
|
|
assets: AssetsSchema.optional(),
|
|
/**
|
|
* @deprecated
|
|
*/
|
|
howto_categories: import_zod.z.union([import_zod.z.string(), import_zod.z.array(import_zod.z.string())]).optional(),
|
|
steps: import_zod.z.any().optional(),
|
|
sourceLanguage: import_zod.z.string().optional(),
|
|
category: import_zod.z.string(),
|
|
product_dimensions: import_zod.z.string().optional(),
|
|
production: ProductionSchema.optional()
|
|
}).passthrough();
|
|
const find_items = (nodes, options) => {
|
|
nodes = nodes.filter(options.filter);
|
|
return nodes.map((c) => {
|
|
const root = (0, import_variables.resolve)(options.root, false, {});
|
|
return {
|
|
rel: (0, import_glob.forward_slash)(`${path.relative(root, path.parse(c).dir)}`),
|
|
path: (0, import_glob.forward_slash)(`${options.root}/${path.relative(root, c)}`),
|
|
config: (0, import_config.readOSRConfig)(c)
|
|
};
|
|
});
|
|
};
|
|
const get = (src, root, type) => {
|
|
const srcInfo = (0, import_glob.pathInfoEx)(src, false, {
|
|
absolute: true
|
|
});
|
|
switch (type) {
|
|
case import_filter.PFilterValid.marketplace_component: {
|
|
const options = {
|
|
filter: import_filter.isValidMarketplaceComponent,
|
|
root
|
|
};
|
|
return find_items(srcInfo.FILES, options);
|
|
}
|
|
case import_filter.PFilterValid.library_component: {
|
|
const options = {
|
|
filter: import_filter.isValidLibraryComponent,
|
|
root
|
|
};
|
|
return find_items(srcInfo.FILES, options);
|
|
}
|
|
case import_filter.PFilterInvalid.marketplace_component: {
|
|
const options = {
|
|
filter: import_filter.isInvalidMarketplaceComponent,
|
|
root
|
|
};
|
|
return find_items(srcInfo.FILES, options);
|
|
}
|
|
}
|
|
};
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
AssetsSchema,
|
|
AuthorSchema,
|
|
ComponentConfigSchema,
|
|
ContentSchema,
|
|
ProductionSchema,
|
|
get
|
|
});
|
|
//# sourceMappingURL=component.cjs.map
|