@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @fluid-app/fluid-cli-theme-dev@0.1.18 build /home/runner/_work/fluid-mono/fluid-mono/packages/cli/theme-dev
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
  ℹ tsdown v0.21.0 powered by rolldown v1.0.0-rc.7
@@ -8,9 +8,9 @@
8
8
  ℹ target: node24
9
9
  ℹ tsconfig: tsconfig.json
10
10
  ℹ Build start
11
- ℹ dist/index.mjs  75.84 kB │ gzip: 20.63 kB
12
- ℹ dist/index.mjs.map 193.35 kB │ gzip: 45.34 kB
11
+ ℹ dist/index.mjs  76.86 kB │ gzip: 21.05 kB
12
+ ℹ dist/index.mjs.map 196.02 kB │ gzip: 46.38 kB
13
13
  ℹ dist/index.d.mts.map  0.11 kB │ gzip: 0.12 kB
14
14
  ℹ dist/index.d.mts  0.19 kB │ gzip: 0.16 kB
15
- ℹ 4 files, total: 269.50 kB
16
- ✔ Build complete in 2984ms
15
+ ℹ 4 files, total: 273.18 kB
16
+ ✔ Build complete in 1274ms
@@ -1,4 +1,4 @@
1
1
 
2
- > @fluid-app/fluid-cli-theme-dev@0.1.18 typecheck /home/runner/_work/fluid-mono/fluid-mono/packages/cli/theme-dev
2
+ > @fluid-app/fluid-cli-theme-dev@0.1.20 typecheck /home/runner/_work/fluid-mono/fluid-mono/packages/cli/theme-dev
3
3
  > tsc --noEmit
4
4
 
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 (including the list of available types).
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}'\nAvailable types:\n${VALID_SETTING_TYPES.join(", \n")}`;
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". Emits one `error` diagnostic per missing section type per template.
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[0] === "templates" && parts.length >= 3 && parts[1] !== "sections" && parts[1] !== "blocks" && parts[1] !== "components";
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] === "templates" && parts[1] === "sections" && parts.length >= 3) return parts[2].replace(/\.liquid$/, "");
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);