@fluid-app/fluid-cli-theme-dev 0.1.18 → 0.1.20
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/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/index.mjs +31 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/commands/lint.ts +24 -13
- package/src/theme/file.ts +17 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @fluid-app/fluid-cli-theme-dev@0.1.
|
|
2
|
+
> @fluid-app/fluid-cli-theme-dev@0.1.20 build /home/runner/_work/fluid-mono/fluid-mono/packages/cli/theme-dev
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.21.0[22m powered by rolldown [2mv1.0.0-rc.7[22m
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
[34mℹ[39m target: [34mnode24[39m
|
|
9
9
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
10
|
[34mℹ[39m Build start
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m
|
|
12
|
-
[34mℹ[39m [2mdist/[22mindex.mjs.map [
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 76.86 kB[22m [2m│ gzip: 21.05 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m196.02 kB[22m [2m│ gzip: 46.38 kB[22m
|
|
13
13
|
[34mℹ[39m [2mdist/[22mindex.d.mts.map [2m 0.11 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
14
14
|
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.19 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
15
|
-
[34mℹ[39m 4 files, total:
|
|
16
|
-
[32m✔[39m Build complete in [
|
|
15
|
+
[34mℹ[39m 4 files, total: 273.18 kB
|
|
16
|
+
[32m✔[39m Build complete in [32m1274ms[39m
|
package/dist/index.mjs
CHANGED
|
@@ -526,10 +526,12 @@ const VALID_SETTING_TYPES = Object.values({
|
|
|
526
526
|
/**
|
|
527
527
|
* Message shown when a setting declares a `type` that is not one of the
|
|
528
528
|
* canonical `VALID_SETTING_TYPES`. Centralized here so the CLI and the editor
|
|
529
|
-
* render identical text
|
|
529
|
+
* render identical text. Kept to a single line — the list of valid types is a
|
|
530
|
+
* static set exposed once via the `VALID_SETTING_TYPES` export, so repeating it
|
|
531
|
+
* in every diagnostic only bloats structured output.
|
|
530
532
|
*/
|
|
531
533
|
function invalidSettingTypeMessage(type) {
|
|
532
|
-
return `Invalid settings type: '${type}'
|
|
534
|
+
return `Invalid settings type: '${type}'`;
|
|
533
535
|
}
|
|
534
536
|
function validateSettings(settings) {
|
|
535
537
|
const diagnostics = [];
|
|
@@ -740,6 +742,16 @@ function validateSchemaText(text, options) {
|
|
|
740
742
|
const LIQUID_COMMENT_REGEX = /\{%-?\s*comment\s*-?%\}[\s\S]*?\{%-?\s*endcomment\s*-?%\}/g;
|
|
741
743
|
const SCHEMA_BLOCK_REGEX = /\{%-?\s*schema\s*-?%\}[\s\S]*?\{%-?\s*endschema\s*-?%\}/;
|
|
742
744
|
const SECTION_TAG_PATTERN = "\\{%-?\\s*section\\s+['\"]([^'\"]+)['\"](?:\\s*,\\s*id:\\s*['\"]([^'\"]+)['\"])?\\s*-?%\\}";
|
|
745
|
+
const RESERVED_SECTION_TYPES = new Set([
|
|
746
|
+
"navbar",
|
|
747
|
+
"library_navbar",
|
|
748
|
+
"footer"
|
|
749
|
+
]);
|
|
750
|
+
const EXTENSION_URI_PATTERN = /^fluid:\/\/extensions\/[^/]+\/[^/]+\/[^/]+$/;
|
|
751
|
+
/** Whether a `{% section %}` type resolves to something other than an on-disk `sections/<name>` definition (and so cannot be flagged as missing). */
|
|
752
|
+
function isNonLocalSectionType(type) {
|
|
753
|
+
return RESERVED_SECTION_TYPES.has(type) || EXTENSION_URI_PATTERN.test(type);
|
|
754
|
+
}
|
|
743
755
|
function templateBody(liquid) {
|
|
744
756
|
return liquid.replace(LIQUID_COMMENT_REGEX, "").replace(SCHEMA_BLOCK_REGEX, "");
|
|
745
757
|
}
|
|
@@ -770,7 +782,9 @@ function extractSectionReferences(liquid) {
|
|
|
770
782
|
/**
|
|
771
783
|
* Find `{% section %}` references that point to a section that does not exist
|
|
772
784
|
* in `existingSectionNames` — the static equivalent of "an in-use section was
|
|
773
|
-
* deleted".
|
|
785
|
+
* deleted". Reserved layout-region types (navbar/footer/library_navbar) and
|
|
786
|
+
* `fluid://` extension URIs are never flagged (see `isNonLocalSectionType`).
|
|
787
|
+
* Emits one `error` diagnostic per missing section type per template.
|
|
774
788
|
*/
|
|
775
789
|
function findMissingSectionReferences(templates, existingSectionNames) {
|
|
776
790
|
const missing = [];
|
|
@@ -778,6 +792,7 @@ function findMissingSectionReferences(templates, existingSectionNames) {
|
|
|
778
792
|
const reported = /* @__PURE__ */ new Set();
|
|
779
793
|
for (const reference of extractSectionReferences(template.content)) {
|
|
780
794
|
if (existingSectionNames.has(reference.type)) continue;
|
|
795
|
+
if (isNonLocalSectionType(reference.type)) continue;
|
|
781
796
|
if (reported.has(reference.type)) continue;
|
|
782
797
|
reported.add(reference.type);
|
|
783
798
|
missing.push({
|
|
@@ -799,6 +814,15 @@ function findMissingSectionReferences(templates, existingSectionNames) {
|
|
|
799
814
|
}
|
|
800
815
|
//#endregion
|
|
801
816
|
//#region src/theme/file.ts
|
|
817
|
+
const NON_TEMPLATE_DIRS = new Set([
|
|
818
|
+
"sections",
|
|
819
|
+
"blocks",
|
|
820
|
+
"components",
|
|
821
|
+
"layouts",
|
|
822
|
+
"config",
|
|
823
|
+
"assets",
|
|
824
|
+
"locales"
|
|
825
|
+
]);
|
|
802
826
|
var ThemeFile = class {
|
|
803
827
|
absolutePath;
|
|
804
828
|
relativePath;
|
|
@@ -843,7 +867,7 @@ var ThemeFile = class {
|
|
|
843
867
|
}
|
|
844
868
|
get isTemplate() {
|
|
845
869
|
const parts = this.relativePath.split(/[/\\]/);
|
|
846
|
-
return parts
|
|
870
|
+
return parts.length >= 2 && !NON_TEMPLATE_DIRS.has(parts[0]);
|
|
847
871
|
}
|
|
848
872
|
validateSchema() {
|
|
849
873
|
if (!this.isLiquid) return [];
|
|
@@ -2034,7 +2058,7 @@ function createPullCommand() {
|
|
|
2034
2058
|
//#region src/commands/lint.ts
|
|
2035
2059
|
function sectionNameOf(relativePath) {
|
|
2036
2060
|
const parts = relativePath.split(/[/\\]/);
|
|
2037
|
-
if (parts[0] === "
|
|
2061
|
+
if (parts[0] === "sections" && parts.length >= 2) return parts[1].replace(/\.liquid$/, "");
|
|
2038
2062
|
return null;
|
|
2039
2063
|
}
|
|
2040
2064
|
function createLintCommand() {
|
|
@@ -2086,11 +2110,13 @@ function createLintCommand() {
|
|
|
2086
2110
|
let warnings = 0;
|
|
2087
2111
|
for (const { diagnostics } of results) for (const d of diagnostics) if (d.severity === "error") errors++;
|
|
2088
2112
|
else warnings++;
|
|
2113
|
+
const hasInvalidSettingType = results.some(({ diagnostics }) => diagnostics.some((d) => d.target?.kind === "setting" && d.target.field === "type" && d.target.settingType !== void 0));
|
|
2089
2114
|
if (opts.json) console.log(JSON.stringify({
|
|
2090
2115
|
ok: errors === 0,
|
|
2091
2116
|
errors,
|
|
2092
2117
|
warnings,
|
|
2093
2118
|
filesChecked: liquidFiles.length,
|
|
2119
|
+
...hasInvalidSettingType ? { validSettingTypes: VALID_SETTING_TYPES } : {},
|
|
2094
2120
|
files: results
|
|
2095
2121
|
}));
|
|
2096
2122
|
else printText(results, errors, warnings, liquidFiles.length);
|