@webpieces/code-rules 0.4.882 → 0.4.884

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/code-rules",
3
- "version": "0.4.882",
3
+ "version": "0.4.884",
4
4
  "description": "Standalone code validation rules extracted from architecture-validators, no Nx dependency required",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -16,19 +16,19 @@
16
16
  "directory": "packages/tooling/code-rules"
17
17
  },
18
18
  "dependencies": {
19
- "@webpieces/rules-config": "0.4.882",
19
+ "@webpieces/rules-config": "0.4.884",
20
20
  "@inversifyjs/binding-decorators": "1.1.5",
21
21
  "inversify": "7.10.4",
22
22
  "reflect-metadata": "0.2.2",
23
- "@webpieces/tooling-common": "0.4.882",
24
- "@webpieces/repo-workflow-core": "0.4.882",
25
- "@webpieces/rules-sdk": "0.4.882"
23
+ "@webpieces/tooling-common": "0.4.884",
24
+ "@webpieces/repo-workflow-core": "0.4.884",
25
+ "@webpieces/rules-sdk": "0.4.884"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
30
  "devDependencies": {
31
- "@webpieces/tooling-testkit": "0.4.882"
31
+ "@webpieces/tooling-testkit": "0.4.884"
32
32
  },
33
33
  "exports": {
34
34
  ".": "./src/index.js",
@@ -1,12 +1,13 @@
1
1
  import { SchemaShape, BaseRuleConfig } from "@webpieces/rules-sdk";
2
2
  /**
3
- * The five rules that make an nx `framework:*` / `role:*` tag TRUE (#1064). Before them a tag was a
4
- * promise only the dependency graph checked; the code inside a library, the folder it lives in and the
5
- * packages it imports were never compared with it.
3
+ * The six rules that make an nx `framework:*` / `role:*` / `product:*` tag TRUE (#1064, #1179). Before
4
+ * them a tag was a promise only the dependency graph checked; the code inside a library, the folder it
5
+ * lives in and the packages it imports were never compared with it.
6
6
  *
7
- * Three are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`
7
+ * Four are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`
8
8
  * and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,
9
- * `api-lib-path` and `framework-folder`. Two are PROJECT rules in `@webpieces/code-rules`:
9
+ * `api-lib-path`, `framework-folder` and `product-tags` (every server, client and app names its
10
+ * product), all owned by `@webpieces/nx-webpieces-rules`. Two are PROJECT rules in `@webpieces/code-rules`:
10
11
  * `framework-tsconfig` and `framework-packages`.
11
12
  *
12
13
  * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FrameworkPackagesConfig = exports.FrameworkPackagesEntry = exports.FrameworkTsconfigConfig = exports.PROJECT_SCAN_MODES = void 0;
4
4
  const rules_sdk_1 = require("@webpieces/rules-sdk");
5
5
  /**
6
- * The five rules that make an nx `framework:*` / `role:*` tag TRUE (#1064). Before them a tag was a
7
- * promise only the dependency graph checked; the code inside a library, the folder it lives in and the
8
- * packages it imports were never compared with it.
6
+ * The six rules that make an nx `framework:*` / `role:*` / `product:*` tag TRUE (#1064, #1179). Before
7
+ * them a tag was a promise only the dependency graph checked; the code inside a library, the folder it
8
+ * lives in and the packages it imports were never compared with it.
9
9
  *
10
- * Three are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`
10
+ * Four are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`
11
11
  * and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,
12
- * `api-lib-path` and `framework-folder`. Two are PROJECT rules in `@webpieces/code-rules`:
12
+ * `api-lib-path`, `framework-folder` and `product-tags` (every server, client and app names its
13
+ * product), all owned by `@webpieces/nx-webpieces-rules`. Two are PROJECT rules in `@webpieces/code-rules`:
13
14
  * `framework-tsconfig` and `framework-packages`.
14
15
  *
15
16
  * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
@@ -1 +1 @@
1
- {"version":3,"file":"tag-truth-configs.js","sourceRoot":"","sources":["../../../../../../packages/tooling/code-rules/src/configs/tag-truth-configs.ts"],"names":[],"mappings":";;;AAAA,oDAA+F;AAC/F;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACU,QAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,CAAU,CAAC;AAI1F;;;;;;;;;;;;GAYG;AACH,MAAa,uBAAwB,SAAQ,0BAAc;IAEvD,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAyC;QAC3D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,0BAAkB,CAAC;QAChD,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,4BAAgB;KACtB,CAAC;;AARN,0DASC;AAED,2EAA2E;AAC3E,MAAa,sBAAsB;IAC/B,oGAAoG;IACpG,QAAQ,CAAY;IACpB,gFAAgF;IAChF,UAAU,CAAY;IAEtB,MAAM,CAAU,MAAM,GAAwC;QAC1D,QAAQ,EAAE,oBAAQ,CAAC,eAAe,EAAE;QACpC,UAAU,EAAE,oBAAQ,CAAC,eAAe,EAAE;KACzC,CAAC;;AATN,wDAUC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,uBAAwB,SAAQ,0BAAc;IAEvD,OAAO,CAA4B;IACnC,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAyC;QAC3D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,0BAAkB,CAAC;QAChD,OAAO,EAAE,oBAAQ,CAAC,eAAe,CAAC,sBAAsB,CAAC,MAAM,CAAC;QAChE,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,4BAAgB;KACtB,CAAC;;AAVN,0DAWC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from \"@webpieces/rules-sdk\";\n/**\n * The five rules that make an nx `framework:*` / `role:*` tag TRUE (#1064). Before them a tag was a\n * promise only the dependency graph checked; the code inside a library, the folder it lives in and the\n * packages it imports were never compared with it.\n *\n * Three are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`\n * and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,\n * `api-lib-path` and `framework-folder`. Two are PROJECT rules in `@webpieces/code-rules`:\n * `framework-tsconfig` and `framework-packages`.\n *\n * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):\n * which packages an api library may import, which folders hold which runtimes, and which framework\n * packages belong to which runtime are the CONSUMER's layout, never webpieces'. The recommended values\n * are SEEDED into a fresh config (seed-entry.ts) and documented in `.claude/rules/framework-tags.md`.\n */\n\n/**\n * The modes of the two PROJECT rules: OFF, MODIFIED_PROJECTS (every project owning a changed file) or\n * RUN_EVERY_TIME (every project in the repo — the migration sweep).\n */\nexport const PROJECT_SCAN_MODES = ['OFF', 'MODIFIED_PROJECTS', 'RUN_EVERY_TIME'] as const;\n\nexport type ProjectScanMode = typeof PROJECT_SCAN_MODES[number];\n\n/**\n * `framework-tsconfig` (D7) — the COMPILER enforces the runtime a library's framework tags promise. Its\n * `tsconfig.lib.json` (with everything it `extends`) must resolve to:\n * - every env a browser one (browser / angular / react): `lib` includes `dom`, `types` excludes `node`;\n * - every env a node one (node / express): `lib` excludes `dom`, `types` includes `node`;\n * - anything else (universal, browser + react-native, react-native): `lib` excludes `dom`, `types`\n * excludes `node` — pure TypeScript.\n * An unset `lib` resolves to TypeScript's default, which includes `dom`; an unset `types` includes every\n * installed `@types/*`, so it counts as including `node`. Both must therefore be stated.\n *\n * - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.\n * - `allowedPaths` — optional globs over project roots this rule skips.\n */\nexport class FrameworkTsconfigConfig extends BaseRuleConfig {\n declare mode?: ProjectScanMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkTsconfigConfig> = {\n mode: new FieldDef('string', PROJECT_SCAN_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/** Framework packages and the runtimes that may import them. Data-only. */\nexport class FrameworkPackagesEntry {\n /** Package-name globs, e.g. `[\"@angular/*\"]` or `[\"react\", \"react-native\", \"expo*\"]`. Non-empty. */\n packages!: string[];\n /** The framework tags allowed to import them, e.g. `[\"angular\"]`. Non-empty. */\n frameworks!: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkPackagesEntry> = {\n packages: FieldDef.nonEmptyStrings(),\n frameworks: FieldDef.nonEmptyStrings(),\n };\n}\n\n/**\n * `framework-packages` (D8) — a framework package is imported only by a project whose EVERY framework\n * tag is one its entry allows. A `browser+node` library importing `firebase-admin` is refused (its\n * browser env cannot run it); a `react` library importing `react` is not.\n *\n * Only production source is read (specs and test setup are not the runtime). A package no entry names\n * is not judged.\n *\n * - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.\n * - `entries` — required, non-empty. The recommended list is in `.claude/rules/framework-tags.md`.\n * - `allowedPaths` — optional globs over project roots this rule skips.\n */\nexport class FrameworkPackagesConfig extends BaseRuleConfig {\n declare mode?: ProjectScanMode;\n entries!: FrameworkPackagesEntry[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkPackagesConfig> = {\n mode: new FieldDef('string', PROJECT_SCAN_MODES),\n entries: FieldDef.nonEmptyObjects(FrameworkPackagesEntry.SCHEMA),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
1
+ {"version":3,"file":"tag-truth-configs.js","sourceRoot":"","sources":["../../../../../../packages/tooling/code-rules/src/configs/tag-truth-configs.ts"],"names":[],"mappings":";;;AAAA,oDAA+F;AAC/F;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACU,QAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,CAAU,CAAC;AAI1F;;;;;;;;;;;;GAYG;AACH,MAAa,uBAAwB,SAAQ,0BAAc;IAEvD,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAyC;QAC3D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,0BAAkB,CAAC;QAChD,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,4BAAgB;KACtB,CAAC;;AARN,0DASC;AAED,2EAA2E;AAC3E,MAAa,sBAAsB;IAC/B,oGAAoG;IACpG,QAAQ,CAAY;IACpB,gFAAgF;IAChF,UAAU,CAAY;IAEtB,MAAM,CAAU,MAAM,GAAwC;QAC1D,QAAQ,EAAE,oBAAQ,CAAC,eAAe,EAAE;QACpC,UAAU,EAAE,oBAAQ,CAAC,eAAe,EAAE;KACzC,CAAC;;AATN,wDAUC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,uBAAwB,SAAQ,0BAAc;IAEvD,OAAO,CAA4B;IACnC,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAyC;QAC3D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,0BAAkB,CAAC;QAChD,OAAO,EAAE,oBAAQ,CAAC,eAAe,CAAC,sBAAsB,CAAC,MAAM,CAAC;QAChE,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,4BAAgB;KACtB,CAAC;;AAVN,0DAWC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from \"@webpieces/rules-sdk\";\n/**\n * The six rules that make an nx `framework:*` / `role:*` / `product:*` tag TRUE (#1064, #1179). Before\n * them a tag was a promise only the dependency graph checked; the code inside a library, the folder it\n * lives in and the packages it imports were never compared with it.\n *\n * Four are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`\n * and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,\n * `api-lib-path`, `framework-folder` and `product-tags` (every server, client and app names its\n * product), all owned by `@webpieces/nx-webpieces-rules`. Two are PROJECT rules in `@webpieces/code-rules`:\n * `framework-tsconfig` and `framework-packages`.\n *\n * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):\n * which packages an api library may import, which folders hold which runtimes, and which framework\n * packages belong to which runtime are the CONSUMER's layout, never webpieces'. The recommended values\n * are SEEDED into a fresh config (seed-entry.ts) and documented in `.claude/rules/framework-tags.md`.\n */\n\n/**\n * The modes of the two PROJECT rules: OFF, MODIFIED_PROJECTS (every project owning a changed file) or\n * RUN_EVERY_TIME (every project in the repo — the migration sweep).\n */\nexport const PROJECT_SCAN_MODES = ['OFF', 'MODIFIED_PROJECTS', 'RUN_EVERY_TIME'] as const;\n\nexport type ProjectScanMode = typeof PROJECT_SCAN_MODES[number];\n\n/**\n * `framework-tsconfig` (D7) — the COMPILER enforces the runtime a library's framework tags promise. Its\n * `tsconfig.lib.json` (with everything it `extends`) must resolve to:\n * - every env a browser one (browser / angular / react): `lib` includes `dom`, `types` excludes `node`;\n * - every env a node one (node / express): `lib` excludes `dom`, `types` includes `node`;\n * - anything else (universal, browser + react-native, react-native): `lib` excludes `dom`, `types`\n * excludes `node` — pure TypeScript.\n * An unset `lib` resolves to TypeScript's default, which includes `dom`; an unset `types` includes every\n * installed `@types/*`, so it counts as including `node`. Both must therefore be stated.\n *\n * - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.\n * - `allowedPaths` — optional globs over project roots this rule skips.\n */\nexport class FrameworkTsconfigConfig extends BaseRuleConfig {\n declare mode?: ProjectScanMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkTsconfigConfig> = {\n mode: new FieldDef('string', PROJECT_SCAN_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/** Framework packages and the runtimes that may import them. Data-only. */\nexport class FrameworkPackagesEntry {\n /** Package-name globs, e.g. `[\"@angular/*\"]` or `[\"react\", \"react-native\", \"expo*\"]`. Non-empty. */\n packages!: string[];\n /** The framework tags allowed to import them, e.g. `[\"angular\"]`. Non-empty. */\n frameworks!: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkPackagesEntry> = {\n packages: FieldDef.nonEmptyStrings(),\n frameworks: FieldDef.nonEmptyStrings(),\n };\n}\n\n/**\n * `framework-packages` (D8) — a framework package is imported only by a project whose EVERY framework\n * tag is one its entry allows. A `browser+node` library importing `firebase-admin` is refused (its\n * browser env cannot run it); a `react` library importing `react` is not.\n *\n * Only production source is read (specs and test setup are not the runtime). A package no entry names\n * is not judged.\n *\n * - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.\n * - `entries` — required, non-empty. The recommended list is in `.claude/rules/framework-tags.md`.\n * - `allowedPaths` — optional globs over project roots this rule skips.\n */\nexport class FrameworkPackagesConfig extends BaseRuleConfig {\n declare mode?: ProjectScanMode;\n entries!: FrameworkPackagesEntry[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkPackagesConfig> = {\n mode: new FieldDef('string', PROJECT_SCAN_MODES),\n entries: FieldDef.nonEmptyObjects(FrameworkPackagesEntry.SCHEMA),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}