@rettangoli/check 0.1.2 → 0.1.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yuusoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software
10
+ is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
+ IN THE SOFTWARE.
package/README.md CHANGED
@@ -15,7 +15,7 @@ Implemented now:
15
15
  - package + CLI entrypoint (`@rettangoli/check`, `rtgl check`)
16
16
  - discovery and component grouping
17
17
  - model building for YAML/JS contracts
18
- - FE parity checks (schema required, forbidden view keys, legacy `.prop=` binding)
18
+ - FE parity checks (schema required, forbidden view keys, unsupported property binding syntax)
19
19
  - schema/constants checks
20
20
  - listener config checks
21
21
  - strict handler naming checks (`handle*` only)
@@ -112,7 +112,7 @@ Current baseline is clean in strict mode:
112
112
 
113
113
  - required `.schema.yaml` per component
114
114
  - forbidden metadata keys inside `.view.yaml`
115
- - legacy `.prop=` syntax detection
115
+ - unsupported property binding syntax detection
116
116
 
117
117
  That baseline is good, but many contract violations are still caught late (during build, runtime, or manually).
118
118
 
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@rettangoli/check",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Static contract checker for Rettangoli projects",
5
5
  "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/yuusoft-org/rettangoli",
9
+ "directory": "packages/rettangoli-check"
10
+ },
6
11
  "main": "./src/index.js",
7
12
  "exports": {
8
13
  ".": "./src/index.js",
@@ -12,7 +17,8 @@
12
17
  "rtgl-check": "./src/cli/bin.js"
13
18
  },
14
19
  "scripts": {
15
- "ci": "npm run test:no-fe-contracts-import && npm run test:scenarios",
20
+ "ci": "npm run test:no-fe-contracts-import && npm run test:ui-registry-resolution-contract && npm run test:scenarios",
21
+ "test:package": "node ./scripts/package-smoke-test.js",
16
22
  "test:scenarios": "node ./test/run-scenarios.js",
17
23
  "test:no-fe-contracts-import": "node ./scripts/test-no-fe-contracts-import.js",
18
24
  "test:diff-js-exports": "node ./scripts/differential-js-exports.js",
@@ -20,6 +26,7 @@
20
26
  "test:fuzz-jempl-parser": "node ./scripts/fuzz-jempl-parser.js",
21
27
  "test:jempl-parser-contract": "node ./scripts/test-jempl-parser-contract.js",
22
28
  "test:scope-graph-range-contract": "node ./scripts/test-scope-graph-range-contract.js",
29
+ "test:ui-registry-resolution-contract": "node ./scripts/test-ui-registry-resolution-contract.js",
23
30
  "test:fe-frontend-component-identity-contract": "node ./scripts/test-fe-frontend-component-identity-contract.js",
24
31
  "test:fe-frontend-handler-contract": "node ./scripts/test-fe-frontend-handler-contract.js",
25
32
  "test:fe-frontend-lifecycle-contract": "node ./scripts/test-fe-frontend-lifecycle-contract.js",
@@ -35,10 +42,12 @@
35
42
  "files": [
36
43
  "src",
37
44
  "README.md",
38
- "ROADMAP.md"
45
+ "ROADMAP.md",
46
+ "LICENSE"
39
47
  ],
40
48
  "license": "MIT",
41
49
  "dependencies": {
50
+ "@rettangoli/ui": "1.11.0",
42
51
  "jempl": "0.3.2-rc2",
43
52
  "js-yaml": "^4.1.0",
44
53
  "oxc-parser": "^0.112.0",
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
+ import { createRequire } from "node:module";
3
4
  import { fileURLToPath, pathToFileURL } from "node:url";
4
5
  import { load as loadYaml } from "js-yaml";
5
6
  import { parseSync } from "oxc-parser";
@@ -713,6 +714,61 @@ const resolveBundledUiDir = () => {
713
714
  return path.resolve(currentDir, "../../../rettangoli-ui");
714
715
  };
715
716
 
717
+ const isUiSourceDir = (candidate) => {
718
+ if (!candidate) {
719
+ return false;
720
+ }
721
+
722
+ const packageJsonPath = path.join(candidate, "package.json");
723
+ const componentsDir = path.join(candidate, "src", "components");
724
+ const entryPath = path.join(candidate, "src", "entry-iife-ui.js");
725
+ if (!existsSync(packageJsonPath) || !existsSync(componentsDir) || !existsSync(entryPath)) {
726
+ return false;
727
+ }
728
+
729
+ try {
730
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
731
+ return packageJson?.name === "@rettangoli/ui";
732
+ } catch {
733
+ return false;
734
+ }
735
+ };
736
+
737
+ const findUiPackageDir = (resolvedEntryPath) => {
738
+ let currentDir = path.dirname(resolvedEntryPath);
739
+ const filesystemRoot = path.parse(currentDir).root;
740
+
741
+ while (currentDir !== filesystemRoot) {
742
+ if (isUiSourceDir(currentDir)) {
743
+ return currentDir;
744
+ }
745
+ currentDir = path.dirname(currentDir);
746
+ }
747
+
748
+ return null;
749
+ };
750
+
751
+ const resolveInstalledUiDir = (baseDir) => {
752
+ try {
753
+ const require = createRequire(path.join(path.resolve(baseDir), "package.json"));
754
+ return findUiPackageDir(require.resolve("@rettangoli/ui"));
755
+ } catch {
756
+ return null;
757
+ }
758
+ };
759
+
760
+ export const resolveUiSourceDir = ({ workspaceRoot = process.cwd() } = {}) => {
761
+ const candidates = [
762
+ path.resolve(workspaceRoot),
763
+ path.resolve(workspaceRoot, "packages", "rettangoli-ui"),
764
+ resolveBundledUiDir(),
765
+ resolveInstalledUiDir(workspaceRoot),
766
+ resolveInstalledUiDir(path.dirname(fileURLToPath(import.meta.url))),
767
+ ];
768
+
769
+ return [...new Set(candidates.filter(Boolean))].find(isUiSourceDir) || null;
770
+ };
771
+
716
772
  const collectPrimitiveContractsFromEntries = async ({ uiDir, globalStyleAttrs }) => {
717
773
  const result = new Map();
718
774
  const entryNames = ["entry-iife-ui.js", "entry-iife-layout.js"];
@@ -729,12 +785,7 @@ const collectPrimitiveContractsFromEntries = async ({ uiDir, globalStyleAttrs })
729
785
  };
730
786
 
731
787
  export const buildUiRegistry = async ({ workspaceRoot = process.cwd() } = {}) => {
732
- const uiCandidates = [
733
- path.resolve(workspaceRoot, "packages", "rettangoli-ui"),
734
- resolveBundledUiDir(),
735
- ];
736
-
737
- const uiDir = uiCandidates.find((candidate) => existsSync(candidate));
788
+ const uiDir = resolveUiSourceDir({ workspaceRoot });
738
789
  if (!uiDir) {
739
790
  return new Map();
740
791
  }
@@ -30,7 +30,7 @@ const CATALOG_VERSION = 1;
30
30
  const CODE_OVERRIDES = {
31
31
  "RTGL-CONTRACT-003": {
32
32
  title: "Legacy dot-prop binding",
33
- description: "Legacy '.prop=' template bindings are unsupported and should be converted to ':prop='.",
33
+ description: "Legacy property binding syntax is unsupported; property bindings must use ':prop=${...}' in source templates.",
34
34
  tags: ["autofix-safe", "template"],
35
35
  },
36
36
  "RTGL-CHECK-YAHTML-002": {
@@ -45,7 +45,7 @@ export const runFeParityRules = ({ models = [] }) => {
45
45
  severity: "error",
46
46
  filePath: viewPath,
47
47
  line: model.view.legacyDotPropBindingLine,
48
- message: `${model.componentKey}: legacy '.prop=' binding is not supported. Use ':prop=' in .view.yaml.`,
48
+ message: `${model.componentKey}: legacy property binding syntax is not supported. Use ':prop=\${value}' in .view.yaml.`,
49
49
  fix: {
50
50
  kind: "line-regex-replace",
51
51
  filePath: viewPath,
@@ -53,7 +53,7 @@ export const runFeParityRules = ({ models = [] }) => {
53
53
  pattern: "\\.([a-zA-Z][\\w-]*)\\s*=",
54
54
  replacement: ":$1=",
55
55
  flags: "g",
56
- description: "Convert legacy '.prop=' binding to ':prop='.",
56
+ description: "Convert legacy '.prop=' prefix to ':prop='; wrap bare values in '${...}' if needed.",
57
57
  safe: true,
58
58
  confidence: 0.98,
59
59
  },