bejamas 0.3.2 → 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.
@@ -1690,6 +1690,15 @@ const STYLES = [
1690
1690
 
1691
1691
  //#endregion
1692
1692
  //#region ../create-config/src/preset.ts
1693
+ const PRESET_STYLES = [
1694
+ "nova",
1695
+ "vega",
1696
+ "maia",
1697
+ "lyra",
1698
+ "mira",
1699
+ "luma",
1700
+ "juno"
1701
+ ];
1693
1702
  const SHARED_PRESET_STYLES = [
1694
1703
  "nova",
1695
1704
  "vega",
@@ -8930,9 +8939,84 @@ const logger = {
8930
8939
  }
8931
8940
  };
8932
8941
 
8942
+ //#endregion
8943
+ //#region src/utils/get-package-info.ts
8944
+ function getPackageInfo(cwd = "", shouldThrow = true) {
8945
+ const packageJsonPath = path$1.join(cwd, "package.json");
8946
+ return fs.readJSONSync(packageJsonPath, { throws: shouldThrow });
8947
+ }
8948
+
8933
8949
  //#endregion
8934
8950
  //#region src/utils/get-project-info.ts
8951
+ const PROJECT_SHARED_IGNORE = [
8952
+ "**/node_modules/**",
8953
+ ".astro",
8954
+ "public",
8955
+ "dist",
8956
+ "build"
8957
+ ];
8935
8958
  const TS_CONFIG_SCHEMA = z.object({ compilerOptions: z.object({ paths: z.record(z.string(), z.string().or(z.array(z.string()))) }) });
8959
+ async function getProjectInfo(cwd) {
8960
+ const [configFiles, tailwindConfigFile, tailwindCssFile, tailwindVersion, aliasPrefix, packageJson] = await Promise.all([
8961
+ fg.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*", {
8962
+ cwd,
8963
+ deep: 3,
8964
+ ignore: PROJECT_SHARED_IGNORE
8965
+ }),
8966
+ getTailwindConfigFile(cwd),
8967
+ getTailwindCssFile(cwd),
8968
+ getTailwindVersion(cwd),
8969
+ getTsConfigAliasPrefix(cwd),
8970
+ getPackageInfo(cwd, false)
8971
+ ]);
8972
+ const type = {
8973
+ isAstro: false,
8974
+ tailwindConfigFile,
8975
+ tailwindCssFile,
8976
+ tailwindVersion,
8977
+ aliasPrefix
8978
+ };
8979
+ if (configFiles.find((file) => file.startsWith("astro.config."))?.length) {
8980
+ type.isAstro = true;
8981
+ return type;
8982
+ }
8983
+ return type;
8984
+ }
8985
+ async function getTailwindVersion(cwd) {
8986
+ const [packageInfo, config] = await Promise.all([getPackageInfo(cwd, false), getConfig(cwd)]);
8987
+ if (config?.tailwind?.config === "") return "v4";
8988
+ if (!packageInfo?.dependencies?.tailwindcss && !packageInfo?.devDependencies?.tailwindcss) return null;
8989
+ if (/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(packageInfo?.dependencies?.tailwindcss || packageInfo?.devDependencies?.tailwindcss || "")) return "v3";
8990
+ return "v4";
8991
+ }
8992
+ async function getTailwindCssFile(cwd) {
8993
+ const [files, tailwindVersion] = await Promise.all([fg.glob(["**/*.css", "**/*.scss"], {
8994
+ cwd,
8995
+ deep: 5,
8996
+ ignore: PROJECT_SHARED_IGNORE
8997
+ }), getTailwindVersion(cwd)]);
8998
+ if (!files.length) return null;
8999
+ for (const file of files) {
9000
+ const contents = await fs.readFile(path$1.resolve(cwd, file), "utf8");
9001
+ if (contents.includes(`@import "tailwindcss"`) || contents.includes(`@import 'tailwindcss'`) || contents.includes(`@tailwind base`)) return file;
9002
+ }
9003
+ return null;
9004
+ }
9005
+ async function getTailwindConfigFile(cwd) {
9006
+ const files = await fg.glob("tailwind.config.*", {
9007
+ cwd,
9008
+ deep: 3,
9009
+ ignore: PROJECT_SHARED_IGNORE
9010
+ });
9011
+ if (!files.length) return null;
9012
+ return files[0];
9013
+ }
9014
+ async function getTsConfigAliasPrefix(cwd) {
9015
+ const tsConfig = await loadConfig(cwd);
9016
+ if (tsConfig?.resultType === "failed" || !Object.entries(tsConfig?.paths).length) return null;
9017
+ for (const [alias, paths] of Object.entries(tsConfig.paths)) if (paths.includes("./*") || paths.includes("./src/*") || paths.includes("./app/*") || paths.includes("./resources/js/*")) return alias.replace(/\/\*$/, "") ?? null;
9018
+ return Object.keys(tsConfig?.paths)?.[0].replace(/\/\*$/, "") ?? null;
9019
+ }
8936
9020
 
8937
9021
  //#endregion
8938
9022
  //#region src/utils/resolve-import.ts
@@ -9316,5 +9400,5 @@ function createSourceFileFromFrontmatter(frontmatterCode) {
9316
9400
  }
9317
9401
 
9318
9402
  //#endregion
9319
- export { getSemanticIconNameFromLucidePath as A, getStyleId as B, buildUiUrl as C, ICON_LIBRARY_COLLECTIONS as D, buildRegistryTheme as E, getDocumentDirection as F, fonts as G, decodePreset as H, getDocumentLanguage as I, __require as K, getFontPackageName as L, DEFAULT_DESIGN_SYSTEM_CONFIG as M, RTL_LANGUAGE_VALUES as N, SEMANTIC_ICON_NAMES as O, designSystemConfigSchema as P, getFontValue as R, BASE_COLORS as S, ICON_LIBRARIES as T, encodePreset as U, normalizeDesignSystemConfig as V, isPresetCode as W, getConfig as _, extractComponentTagsFromMDX as a, highlighter as b, extractPropsFromDeclaredProps as c, parseJsDocMetadata as d, resolveOutDir as f, spinner as g, toIdentifier as h, discoverExamples as i, renderSemanticIconSvgWithAttributeString as j, getSemanticIconNameFromLucideExport as k, normalizeBlockMDX as l, slugify as m, createSourceFileFromFrontmatter as n, extractFrontmatter as o, resolveUiRoot as p, detectHasImportTopLevel as r, extractPropsFromAstroProps as s, RESERVED_COMPONENTS as t, normalizeUsageMDX as u, getWorkspaceConfig as v, resolveRegistryUrl as w, BEJAMAS_COMPONENTS_SCHEMA_URL as x, logger as y, getHeadingFontValue as z };
9320
- //# sourceMappingURL=utils-B0HWwl6F.js.map
9403
+ export { PRESET_RADII as $, getSemanticIconNameFromLucideExport as A, getHeadingFontValue as B, BASE_COLORS as C, buildRegistryTheme as D, ICON_LIBRARIES as E, designSystemConfigSchema as F, DEFAULT_PRESET_CONFIG as G, getStyleDefaultRadius as H, getDocumentDirection as I, PRESET_FONTS as J, PRESET_BASE_COLORS as K, getDocumentLanguage as L, renderSemanticIconSvgWithAttributeString as M, DEFAULT_DESIGN_SYSTEM_CONFIG as N, ICON_LIBRARY_COLLECTIONS as O, RTL_LANGUAGE_VALUES as P, PRESET_MENU_COLORS as Q, getFontPackageName as R, BEJAMAS_COMPONENTS_SCHEMA_URL as S, resolveRegistryUrl as T, getStyleId as U, getRadiusValue as V, normalizeDesignSystemConfig as W, PRESET_ICON_LIBRARIES as X, PRESET_FONT_HEADINGS as Y, PRESET_MENU_ACCENTS as Z, getConfig as _, extractComponentTagsFromMDX as a, isPresetCode as at, logger as b, extractPropsFromDeclaredProps as c, parseJsDocMetadata as d, PRESET_STYLES as et, resolveOutDir as f, spinner as g, toIdentifier as h, discoverExamples as i, encodePreset as it, getSemanticIconNameFromLucidePath as j, SEMANTIC_ICON_NAMES as k, normalizeBlockMDX as l, slugify as m, createSourceFileFromFrontmatter as n, V1_CHART_COLOR_MAP as nt, extractFrontmatter as o, fonts as ot, resolveUiRoot as p, PRESET_CHART_COLORS as q, detectHasImportTopLevel as r, decodePreset as rt, extractPropsFromAstroProps as s, __require as st, RESERVED_COMPONENTS as t, PRESET_THEMES as tt, normalizeUsageMDX as u, getWorkspaceConfig as v, buildUiUrl as w, highlighter as x, getProjectInfo as y, getFontValue as z };
9404
+ //# sourceMappingURL=utils-otwzm7kH.js.map