rtl-analyzer 0.2.0 → 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.
Files changed (60) hide show
  1. package/README.md +90 -56
  2. package/dist/cli.js +18 -1
  3. package/dist/codemod.js +50 -12
  4. package/dist/companion-security.js +2 -0
  5. package/dist/contextual-preview-bridge.js +118 -0
  6. package/dist/contextual-preview.js +74 -0
  7. package/dist/controlled-apply.js +222 -0
  8. package/dist/css-configured-proposal.js +98 -0
  9. package/dist/css-directional.js +60 -0
  10. package/dist/css-icons.js +51 -0
  11. package/dist/css-spacing.js +65 -0
  12. package/dist/dashboard-batch-review.js +37 -0
  13. package/dist/dashboard-client.js +73 -50
  14. package/dist/dashboard-contextual-preview.js +127 -0
  15. package/dist/dashboard-data.js +4 -4
  16. package/dist/dashboard-embedded-preview.js +202 -0
  17. package/dist/dashboard-html.js +13 -10
  18. package/dist/dashboard-operation-flow.js +47 -0
  19. package/dist/dashboard-review-details.js +175 -0
  20. package/dist/dashboard-review-navigation.js +19 -0
  21. package/dist/dashboard-review-workflow.js +219 -0
  22. package/dist/dashboard-themes.js +34 -0
  23. package/dist/directional-properties.js +53 -0
  24. package/dist/discovery.js +1 -2
  25. package/dist/eligibility.js +8 -8
  26. package/dist/evidence-store.js +110 -0
  27. package/dist/example-preview-mappings.js +98 -0
  28. package/dist/manual-change-store.js +27 -0
  29. package/dist/migration-lifecycle.js +19 -0
  30. package/dist/original-preview-runtime.js +78 -0
  31. package/dist/output-path.js +65 -0
  32. package/dist/page-navigation.js +17 -0
  33. package/dist/policy-validation.js +7 -4
  34. package/dist/preview-cli.js +22 -0
  35. package/dist/preview-companion.js +649 -0
  36. package/dist/preview-configuration.js +171 -0
  37. package/dist/preview-runtime.js +102 -0
  38. package/dist/project-configuration.js +48 -0
  39. package/dist/project-root.js +12 -0
  40. package/dist/react-inline.js +65 -0
  41. package/dist/report-publisher.js +4 -7
  42. package/dist/review-approval.js +9 -0
  43. package/dist/review-session.js +211 -56
  44. package/dist/review-store.js +175 -0
  45. package/dist/review-workflow.js +820 -0
  46. package/dist/rules.js +27 -17
  47. package/dist/runtime-process.js +35 -0
  48. package/dist/scan-history.js +35 -0
  49. package/dist/scan-manifest-store.js +26 -0
  50. package/dist/scan.js +55 -4
  51. package/dist/scoped-direction-evidence.js +117 -0
  52. package/dist/serialization.js +1 -0
  53. package/dist/source-context.js +93 -0
  54. package/dist/source-snippets.js +3 -3
  55. package/dist/standalone-cli.js +14 -1
  56. package/dist/tailwind.js +3 -1
  57. package/dist/transformations.js +34 -0
  58. package/dist/validation.js +75 -0
  59. package/dist/workflow-validation.js +46 -0
  60. package/package.json +17 -8
@@ -7,7 +7,7 @@ export const ruleIds = new Set([
7
7
  'RTL.CSS.PHYSICAL', 'RTL.CSS.SHORTHAND', 'RTL.GEOMETRY.EDGE', 'RTL.GEOMETRY.COUPLED', 'RTL.GEOMETRY.ORDER',
8
8
  'RTL.OWNERSHIP.CONFLICT', 'RTL.RUNTIME.MISMATCH', 'RTL.RUNTIME.CACHE', 'RTL.RUNTIME.CACHE_UNVERIFIED',
9
9
  'RTL.RUNTIME.DIRECTION_UNKNOWN', 'RTL.RUNTIME.PAGINATION', 'RTL.RUNTIME.LOCALE', 'RTL.FORM.DIRECTION',
10
- 'RTL.TABLE.ALIGNMENT', 'RTL.CHART.LABEL_FLOW', 'RTL.ICON.PROGRESSION', 'RTL.ICON.LITERAL',
10
+ 'RTL.UTILITY.PHYSICAL', 'RTL.TABLE.ALIGNMENT', 'RTL.CHART.LABEL_FLOW', 'RTL.ICON.PROGRESSION', 'RTL.ICON.LITERAL',
11
11
  'RTL.BIDI.ISOLATION', 'RTL.BRAND.ISLAND', 'RTL.DOCUMENT.INITIAL', 'RTL.DOCUMENT.RUNTIME',
12
12
  ]);
13
13
  export const findingIdPattern = /^RTL\.[A-Z_]+(?:\.[A-Z_]+)*:[a-f0-9]{24}$/;
@@ -74,7 +74,7 @@ export function validatePolicy(input, text) {
74
74
  fail(p, 'expected lowercase SHA-256 digest'); };
75
75
  const rule = (v, p) => { if (!ruleIds.has(str(v, p)))
76
76
  fail(p, 'rule is not supported by this scanner', 'POLICY_UNSUPPORTED'); };
77
- const top = object(input, '', ['schemaVersion', 'generatedStyleOwner', 'ownership', 'approvals', 'exceptions', 'issueBindings', 'dynamicExceptions', 'roles'], ['ownerOverrides']);
77
+ const top = object(input, '', ['schemaVersion', 'generatedStyleOwner', 'ownership', 'approvals', 'exceptions', 'issueBindings', 'dynamicExceptions', 'roles'], ['ownerOverrides', 'cssProposals']);
78
78
  if (top.schemaVersion !== 1)
79
79
  fail('/schemaVersion', 'only schemaVersion 1 is supported', 'POLICY_UNSUPPORTED');
80
80
  enumValue(top.generatedStyleOwner, '/generatedStyleOwner', ['mui-generated', 'unknown']);
@@ -90,15 +90,16 @@ export function validatePolicy(input, text) {
90
90
  issueBindings: [['ruleId', 'path', 'contextIncludes', 'issueId'], ['originalIncludes']],
91
91
  dynamicExceptions: [['path', 'property', 'valueDigest', 'sourceDigest', 'reason'], []],
92
92
  roles: [['kind', 'path', 'className'], []],
93
+ cssProposals: [['path', 'context', 'property', 'value', 'kind', 'sourceDigest'], []],
93
94
  ownerOverrides: [['path', 'context', 'owner', 'reason'], []],
94
95
  };
95
96
  const identities = {
96
97
  approvals: ['path', 'context', 'property', 'value'], exceptions: ['ruleId', 'path', 'context', 'originalDigest'],
97
98
  issueBindings: ['ruleId', 'path', 'contextIncludes', 'originalIncludes', 'issueId'],
98
- dynamicExceptions: ['path', 'property', 'valueDigest'], roles: ['kind', 'path', 'className'], ownerOverrides: ['path', 'context'],
99
+ dynamicExceptions: ['path', 'property', 'valueDigest'], roles: ['kind', 'path', 'className'], ownerOverrides: ['path', 'context'], cssProposals: ['path', 'context', 'property', 'value'],
99
100
  };
100
101
  for (const [name, [required, optional]] of Object.entries(shapes)) {
101
- if (name === 'ownerOverrides' && !Object.hasOwn(top, name))
102
+ if ((name === 'ownerOverrides' || name === 'cssProposals') && !Object.hasOwn(top, name))
102
103
  continue;
103
104
  const records = top[name];
104
105
  if (!Array.isArray(records) || records.length > 10000)
@@ -118,6 +119,8 @@ export function validatePolicy(input, text) {
118
119
  enumValue(entry.owner, `${p}/owner`, owners);
119
120
  if ('category' in entry)
120
121
  enumValue(entry.category, `${p}/category`, ['INTENTIONAL_LTR', 'INFORMATIONAL']);
122
+ if (name === 'cssProposals')
123
+ enumValue(entry.kind, `${p}/kind`, ['inline-edge', 'logical-corners', 'dom-order', 'mirror-offset']);
121
124
  if (name === 'roles')
122
125
  enumValue(entry.kind, `${p}/kind`, ['brand']);
123
126
  if (name === 'dynamicExceptions')
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ // Keep help independent of project configuration and persisted review stores.
3
+ const args = process.argv.slice(2);
4
+ if (args.length === 1 && ['--help', '-h'].includes(args[0])) {
5
+ console.log(`Usage: RTL_PROJECT_ROOT=/absolute/project rtl-preview
6
+
7
+ Start the local review companion on http://127.0.0.1:4318.
8
+ Serve generated dashboard artifacts at http://127.0.0.1:4320.
9
+ Configure rtl-project.config.json and rtl-preview.config.json for standalone Vite projects.
10
+ Install the project's dependencies and Playwright Chromium before runtime validation.
11
+ Review state defaults to ~/.rtl-migration-analyzer; Apply backups default to OS temporary storage.
12
+ See README for RTL_* overrides and required state filenames.
13
+ Use Ctrl-C to stop the companion and its owned preview runtimes.`);
14
+ }
15
+ else if (args.length) {
16
+ console.error('Unknown option. Use rtl-preview --help.');
17
+ process.exitCode = 2;
18
+ }
19
+ else {
20
+ await import('./preview-companion.js');
21
+ }
22
+ export {};