meno-astro 0.1.1 → 0.1.2
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/dist/chunks/chunk-2U5OLFVL.js +24 -0
- package/dist/chunks/chunk-2U5OLFVL.js.map +7 -0
- package/dist/chunks/{chunk-PQQAY42O.js → chunk-DY7HYV2D.js} +2 -2
- package/dist/chunks/{chunk-IVGZB6XN.js → chunk-OT56NX4T.js} +89 -21
- package/dist/chunks/chunk-OT56NX4T.js.map +7 -0
- package/dist/lib/dialect/index.js +166 -36
- package/dist/lib/dialect/index.js.map +4 -4
- package/dist/lib/index.js +7 -6
- package/dist/lib/index.js.map +2 -2
- package/dist/lib/integration/index.js +2 -2
- package/dist/lib/runtime/localeMiddleware.js +3 -3
- package/package.json +1 -1
- package/dist/chunks/chunk-IVGZB6XN.js.map +0 -7
- package/dist/chunks/chunk-LEMVUKVG.js +0 -90
- package/dist/chunks/chunk-LEMVUKVG.js.map +0 -7
- /package/dist/chunks/{chunk-PQQAY42O.js.map → chunk-DY7HYV2D.js.map} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_I18N_CONFIG,
|
|
3
|
+
migrateI18nConfig
|
|
4
|
+
} from "./chunk-OT56NX4T.js";
|
|
5
|
+
|
|
6
|
+
// lib/server/loadI18nConfig.ts
|
|
7
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
function loadI18nConfig(projectRoot) {
|
|
10
|
+
try {
|
|
11
|
+
const cfgPath = join(projectRoot, "project.config.json");
|
|
12
|
+
if (!existsSync(cfgPath)) return DEFAULT_I18N_CONFIG;
|
|
13
|
+
const raw = readFileSync(cfgPath, "utf8");
|
|
14
|
+
const parsed = JSON.parse(raw);
|
|
15
|
+
return migrateI18nConfig(parsed.i18n);
|
|
16
|
+
} catch {
|
|
17
|
+
return DEFAULT_I18N_CONFIG;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
loadI18nConfig
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-2U5OLFVL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/server/loadI18nConfig.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * meno-astro/server \u2014 `loadI18nConfig`.\n *\n * Reads a converted project's `project.config.json`, pulls its `.i18n` block, and runs it\n * through meno-core's `migrateI18nConfig` so both the modern `LocaleConfig[]` shape and the\n * legacy `string[]` locales shape resolve to a canonical {@link I18nConfig}. Any failure\n * (missing file, unparseable JSON, absent/empty `.i18n`) degrades to\n * `DEFAULT_I18N_CONFIG` rather than throwing \u2014 a project should always render in *some*\n * locale, even one that predates i18n config.\n *\n * This is the single source of truth the locale middleware (and, by extension, every\n * `i18n()` call) reads its config from. It is server/build-only (touches the filesystem)\n * and reuses meno-core wholesale \u2014 no migration logic is reinvented here.\n */\n\nimport { existsSync, readFileSync } from 'fs';\nimport { join } from 'path';\nimport { migrateI18nConfig, DEFAULT_I18N_CONFIG } from 'meno-core/shared';\nimport type { I18nConfig } from 'meno-core/shared/types';\n\n/**\n * Load the i18n config for the project rooted at `projectRoot`.\n *\n * Resolution:\n * 1. Read `<projectRoot>/project.config.json`. Missing/unreadable \u2192 `DEFAULT_I18N_CONFIG`.\n * 2. Take its `.i18n` value and run `migrateI18nConfig` (handles modern + legacy shapes,\n * and itself falls back to `DEFAULT_I18N_CONFIG` for anything it can't interpret).\n *\n * Never throws: every failure path returns `DEFAULT_I18N_CONFIG`.\n */\nexport function loadI18nConfig(projectRoot: string): I18nConfig {\n try {\n const cfgPath = join(projectRoot, 'project.config.json');\n if (!existsSync(cfgPath)) return DEFAULT_I18N_CONFIG;\n const raw = readFileSync(cfgPath, 'utf8');\n const parsed = JSON.parse(raw) as { i18n?: unknown };\n // migrateI18nConfig itself returns DEFAULT_I18N_CONFIG for undefined/empty/invalid.\n return migrateI18nConfig(parsed.i18n);\n } catch {\n return DEFAULT_I18N_CONFIG;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAeA,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAAY;AAcd,SAAS,eAAe,aAAiC;AAC9D,MAAI;AACF,UAAM,UAAU,KAAK,aAAa,qBAAqB;AACvD,QAAI,CAAC,WAAW,OAAO,EAAG,QAAO;AACjC,UAAM,MAAM,aAAa,SAAS,MAAM;AACxC,UAAM,SAAS,KAAK,MAAM,GAAG;AAE7B,WAAO,kBAAkB,OAAO,IAAI;AAAA,EACtC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
extractLocaleFromPath,
|
|
4
4
|
isI18nValue,
|
|
5
5
|
resolveI18nValue
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OT56NX4T.js";
|
|
7
7
|
import {
|
|
8
8
|
__require
|
|
9
9
|
} from "./chunk-ZYQNHI3W.js";
|
|
@@ -88,4 +88,4 @@ export {
|
|
|
88
88
|
deriveLocale,
|
|
89
89
|
createLocaleMiddleware
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-DY7HYV2D.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMMENT_STATUSES
|
|
3
|
-
} from "./chunk-LEMVUKVG.js";
|
|
4
1
|
import {
|
|
5
2
|
__esm
|
|
6
3
|
} from "./chunk-ZYQNHI3W.js";
|
|
@@ -1651,6 +1648,91 @@ function serializeValue(value) {
|
|
|
1651
1648
|
return String(value);
|
|
1652
1649
|
}
|
|
1653
1650
|
|
|
1651
|
+
// ../core/lib/shared/types/cms.ts
|
|
1652
|
+
var IRREGULAR_PLURALS = {
|
|
1653
|
+
categories: "category",
|
|
1654
|
+
children: "child",
|
|
1655
|
+
people: "person",
|
|
1656
|
+
men: "man",
|
|
1657
|
+
women: "woman",
|
|
1658
|
+
feet: "foot",
|
|
1659
|
+
teeth: "tooth",
|
|
1660
|
+
geese: "goose",
|
|
1661
|
+
mice: "mouse",
|
|
1662
|
+
indices: "index",
|
|
1663
|
+
vertices: "vertex",
|
|
1664
|
+
matrices: "matrix"
|
|
1665
|
+
};
|
|
1666
|
+
function singularize(collection) {
|
|
1667
|
+
if (IRREGULAR_PLURALS[collection]) {
|
|
1668
|
+
return IRREGULAR_PLURALS[collection];
|
|
1669
|
+
}
|
|
1670
|
+
if (collection.endsWith("ies")) {
|
|
1671
|
+
return collection.slice(0, -3) + "y";
|
|
1672
|
+
}
|
|
1673
|
+
if (collection.endsWith("ses") || collection.endsWith("xes") || collection.endsWith("zes") || collection.endsWith("ches") || collection.endsWith("shes")) {
|
|
1674
|
+
return collection.slice(0, -2);
|
|
1675
|
+
}
|
|
1676
|
+
return collection.endsWith("s") ? collection.slice(0, -1) : collection;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
// ../core/lib/shared/types/prefetch.ts
|
|
1680
|
+
var DEFAULT_PREFETCH_CONFIG = {
|
|
1681
|
+
enabled: false,
|
|
1682
|
+
defaultStrategy: "hover",
|
|
1683
|
+
hoverDebounce: 65,
|
|
1684
|
+
maxCacheSize: 10,
|
|
1685
|
+
cacheTTL: 5 * 60 * 1e3,
|
|
1686
|
+
// 5 minutes
|
|
1687
|
+
respectSaveData: true,
|
|
1688
|
+
slowConnectionThreshold: 2
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
// ../core/lib/shared/types/variables.ts
|
|
1692
|
+
var VARIABLE_GROUPS = [
|
|
1693
|
+
{ value: "font-family", label: "Font Family" },
|
|
1694
|
+
{ value: "font-size", label: "Font Size" },
|
|
1695
|
+
{ value: "font-weight", label: "Font Weight" },
|
|
1696
|
+
{ value: "line-height", label: "Line Height" },
|
|
1697
|
+
{ value: "letter-spacing", label: "Letter Spacing" },
|
|
1698
|
+
{ value: "margin", label: "Margin" },
|
|
1699
|
+
{ value: "padding", label: "Padding" },
|
|
1700
|
+
{ value: "gap", label: "Gap" },
|
|
1701
|
+
{ value: "size", label: "Size" },
|
|
1702
|
+
{ value: "position", label: "Position" },
|
|
1703
|
+
{ value: "border-radius", label: "Border Radius" },
|
|
1704
|
+
{ value: "border-width", label: "Border Width" },
|
|
1705
|
+
{ value: "outline", label: "Outline" },
|
|
1706
|
+
{ value: "shadow", label: "Shadow" },
|
|
1707
|
+
{ value: "filter", label: "Filter" },
|
|
1708
|
+
{ value: "duration", label: "Duration" },
|
|
1709
|
+
{ value: "aspect-ratio", label: "Aspect Ratio" },
|
|
1710
|
+
{ value: "opacity", label: "Opacity" },
|
|
1711
|
+
{ value: "z-index", label: "Z-Index" },
|
|
1712
|
+
{ value: "text-align", label: "Text Align" },
|
|
1713
|
+
{ value: "other", label: "Other" }
|
|
1714
|
+
];
|
|
1715
|
+
var VARIABLE_GROUP_VALUES = VARIABLE_GROUPS.map((g) => g.value);
|
|
1716
|
+
var VARIABLE_TYPES = [
|
|
1717
|
+
{ value: "fontSize", label: "Font Size" },
|
|
1718
|
+
{ value: "padding", label: "Padding" },
|
|
1719
|
+
{ value: "margin", label: "Margin" },
|
|
1720
|
+
{ value: "gap", label: "Gap" },
|
|
1721
|
+
{ value: "borderRadius", label: "Border Radius" },
|
|
1722
|
+
{ value: "size", label: "Width / Height" },
|
|
1723
|
+
{ value: "none", label: "None" }
|
|
1724
|
+
];
|
|
1725
|
+
var VARIABLE_TYPE_VALUES = VARIABLE_TYPES.map((t) => t.value);
|
|
1726
|
+
|
|
1727
|
+
// ../core/lib/shared/types/comment.ts
|
|
1728
|
+
var COMMENT_STATUSES = [
|
|
1729
|
+
"open",
|
|
1730
|
+
"in-progress",
|
|
1731
|
+
"ready-for-review",
|
|
1732
|
+
"resolved",
|
|
1733
|
+
"closed"
|
|
1734
|
+
];
|
|
1735
|
+
|
|
1654
1736
|
// ../core/lib/shared/index.ts
|
|
1655
1737
|
init_constants();
|
|
1656
1738
|
|
|
@@ -2887,26 +2969,13 @@ function isStyleMapping(value) {
|
|
|
2887
2969
|
return typeof value === "object" && value !== null && "_mapping" in value && value._mapping === true;
|
|
2888
2970
|
}
|
|
2889
2971
|
|
|
2890
|
-
// lib/server/loadI18nConfig.ts
|
|
2891
|
-
import { existsSync, readFileSync } from "fs";
|
|
2892
|
-
import { join } from "path";
|
|
2893
|
-
function loadI18nConfig(projectRoot) {
|
|
2894
|
-
try {
|
|
2895
|
-
const cfgPath = join(projectRoot, "project.config.json");
|
|
2896
|
-
if (!existsSync(cfgPath)) return DEFAULT_I18N_CONFIG;
|
|
2897
|
-
const raw = readFileSync(cfgPath, "utf8");
|
|
2898
|
-
const parsed = JSON.parse(raw);
|
|
2899
|
-
return migrateI18nConfig(parsed.i18n);
|
|
2900
|
-
} catch {
|
|
2901
|
-
return DEFAULT_I18N_CONFIG;
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
|
|
2905
2972
|
export {
|
|
2973
|
+
singularize,
|
|
2906
2974
|
DEFAULT_BREAKPOINTS,
|
|
2907
2975
|
generateInteractiveCSS,
|
|
2908
2976
|
shortHash,
|
|
2909
2977
|
DEFAULT_I18N_CONFIG,
|
|
2978
|
+
migrateI18nConfig,
|
|
2910
2979
|
isI18nValue,
|
|
2911
2980
|
resolveI18nValue,
|
|
2912
2981
|
extractLocaleFromPath,
|
|
@@ -2915,7 +2984,6 @@ export {
|
|
|
2915
2984
|
parseSortExpression,
|
|
2916
2985
|
serializeSortExpression,
|
|
2917
2986
|
parseFilterExpression,
|
|
2918
|
-
serializeFilterExpression
|
|
2919
|
-
loadI18nConfig
|
|
2987
|
+
serializeFilterExpression
|
|
2920
2988
|
};
|
|
2921
|
-
//# sourceMappingURL=chunk-
|
|
2989
|
+
//# sourceMappingURL=chunk-OT56NX4T.js.map
|