@webpieces/code-rules 0.4.979 → 0.4.981
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 +8 -7
- package/src/code-policy-registry.js +5 -0
- package/src/code-policy-registry.js.map +1 -1
- package/src/configs/ipc-configs.d.ts +158 -0
- package/src/configs/ipc-configs.js +206 -0
- package/src/configs/ipc-configs.js.map +1 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +20 -1
- package/src/index.js.map +1 -1
- package/src/ipc/ipc-boundary-analyzer.d.ts +92 -0
- package/src/ipc/ipc-boundary-analyzer.js +371 -0
- package/src/ipc/ipc-boundary-analyzer.js.map +1 -0
- package/src/ipc/ipc-contract-inventory.d.ts +83 -0
- package/src/ipc/ipc-contract-inventory.js +215 -0
- package/src/ipc/ipc-contract-inventory.js.map +1 -0
- package/src/ipc/ipc-contract-shape-analyzer.d.ts +54 -0
- package/src/ipc/ipc-contract-shape-analyzer.js +186 -0
- package/src/ipc/ipc-contract-shape-analyzer.js.map +1 -0
- package/src/ipc/ipc-controller-resolver.d.ts +43 -0
- package/src/ipc/ipc-controller-resolver.js +187 -0
- package/src/ipc/ipc-controller-resolver.js.map +1 -0
- package/src/ipc/ipc-pairing-analyzer.d.ts +43 -0
- package/src/ipc/ipc-pairing-analyzer.js +247 -0
- package/src/ipc/ipc-pairing-analyzer.js.map +1 -0
- package/src/ipc/ipc-protocol-fingerprint.d.ts +50 -0
- package/src/ipc/ipc-protocol-fingerprint.js +215 -0
- package/src/ipc/ipc-protocol-fingerprint.js.map +1 -0
- package/src/ipc/ipc-protocol-recorder.d.ts +25 -0
- package/src/ipc/ipc-protocol-recorder.js +98 -0
- package/src/ipc/ipc-protocol-recorder.js.map +1 -0
- package/src/ipc/ipc-rule-support.d.ts +27 -0
- package/src/ipc/ipc-rule-support.js +76 -0
- package/src/ipc/ipc-rule-support.js.map +1 -0
- package/src/ipc/ipc-source.d.ts +96 -0
- package/src/ipc/ipc-source.js +239 -0
- package/src/ipc/ipc-source.js.map +1 -0
- package/src/ipc-record-protocol.d.ts +2 -0
- package/src/ipc-record-protocol.js +34 -0
- package/src/ipc-record-protocol.js.map +1 -0
- package/src/rule-help.js +4 -0
- package/src/rule-help.js.map +1 -1
- package/src/rule-settings.js +119 -1
- package/src/rule-settings.js.map +1 -1
- package/src/validate-ipc-boundary.d.ts +20 -0
- package/src/validate-ipc-boundary.js +96 -0
- package/src/validate-ipc-boundary.js.map +1 -0
- package/src/validate-ipc-contract-shape.d.ts +20 -0
- package/src/validate-ipc-contract-shape.js +105 -0
- package/src/validate-ipc-contract-shape.js.map +1 -0
- package/src/validate-ipc-pairing.d.ts +16 -0
- package/src/validate-ipc-pairing.js +71 -0
- package/src/validate-ipc-pairing.js.map +1 -0
- package/src/validate-ipc-protocol-fingerprint.d.ts +23 -0
- package/src/validate-ipc-protocol-fingerprint.js +79 -0
- package/src/validate-ipc-protocol-fingerprint.js.map +1 -0
package/src/rule-settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-settings.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/rule-settings.ts"],"names":[],"mappings":";;;AAEA,oFAAoF;AACvE,QAAA,cAAc,GAA2C;IAClE,kBAAkB,EAAE;QAChB,OAAO,EAAE,EAAE;KACd;IACD,gBAAgB,EAAE;QACd,OAAO,EAAE,GAAG;KACf;IACD,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,EAAE;IACrB,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,gBAAgB,EAAE;QACd,eAAe,EAAE,IAAI;KACxB;IACD,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,sBAAsB,EAAE,EAAE;IAC1B,mCAAmC,EAAE,EAAE;IACvC,qBAAqB,EAAE,EAAE;IACzB,6CAA6C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SAAS,EAAE;YACP;gBACI,OAAO,EAAE;oBACL,mBAAmB;iBACtB;gBACD,UAAU,EAAE;oBACR,SAAS;oBACT,UAAU;oBACV,OAAO;oBACP,KAAK;oBACL,KAAK;iBACR;gBACD,QAAQ,EAAE,KAAK;aAClB;SACJ;KACJ;IACD,oBAAoB,EAAE;QAClB,MAAM,EAAE,mBAAmB;QAC3B,uBAAuB,EAAE,CAAC;QAC1B,0BAA0B,EAAE,IAAI;KACnC;IACD,oBAAoB,EAAE;QAClB,MAAM,EAAE,mBAAmB;QAC3B,uBAAuB,EAAE,CAAC;QAC1B,0BAA0B,EAAE,IAAI;QAChC,SAAS,EAAE;YACP;gBACI,UAAU,EAAE;oBACR,YAAY;iBACf;gBACD,YAAY,EAAE;oBACV,SAAS;iBACZ;aACJ;YACD;gBACI,UAAU,EAAE;oBACR,OAAO;oBACP,cAAc;oBACd,OAAO;oBACP,SAAS;oBACT,sBAAsB;iBACzB;gBACD,YAAY,EAAE;oBACV,OAAO;oBACP,cAAc;iBACjB;aACJ;YACD;gBACI,UAAU,EAAE;oBACR,SAAS;oBACT,gBAAgB;oBAChB,YAAY;oBACZ,qBAAqB;oBACrB,iBAAiB;iBACpB;gBACD,YAAY,EAAE;oBACV,MAAM;oBACN,SAAS;iBACZ;aACJ;YACD;gBACI,UAAU,EAAE;oBACR,UAAU;iBACb;gBACD,YAAY,EAAE;oBACV,SAAS;oBACT,SAAS;oBACT,OAAO;iBACV;aACJ;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import { ConfigObject } from '@webpieces/rules-sdk';\n\n/** Optional knobs only. Required behaviour is always supplied by the repository. */\nexport const optionalTuning: Readonly<Record<string, ConfigObject>> = {\n \"max-method-lines\": {\n \"limit\": 80\n },\n \"max-file-lines\": {\n \"limit\": 900\n },\n \"require-return-type\": {},\n \"no-inline-type-literals\": {},\n \"no-any-unknown\": {},\n \"no-implicit-any\": {},\n \"prisma-validate-dtos\": {},\n \"prisma-converter\": {},\n \"no-destructure\": {\n \"allowTopLevel\": true\n },\n \"catch-error-pattern\": {},\n \"no-unmanaged-exceptions\": {},\n \"catch-must-propagate\": {},\n \"angular-no-direct-api-in-resolver\": {},\n \"no-symbol-di-tokens\": {},\n \"no-client-creation-outside-server-or-client\": {},\n \"no-custom-css\": {\n \"allowGlobs\": []\n },\n \"no-state-paths-in-templates\": {},\n \"no-process-exit-outside-main\": {},\n \"no-function-outside-class\": {},\n \"inject-annotation-not-needed-for-concrete-class\": {},\n \"framework-tag\": {\n \"knownTypes\": [\n \"browser\",\n \"react\",\n \"angular\",\n \"node\",\n \"express\",\n \"react-native\"\n ]\n },\n \"role-tag\": {\n \"knownTypes\": [\n \"server\",\n \"app\",\n \"bundle\",\n \"designed-lib\",\n \"lib\",\n \"client\",\n \"api-lib\",\n \"api-client\"\n ]\n },\n \"ensure-we-are-secure\": {},\n \"no-inline-import-in-api-lib\": {},\n \"one-enum-spelling-in-api-lib\": {},\n \"no-utility-types-in-api-lib\": {},\n \"required-type-suffix\": {},\n \"framework-tsconfig\": {},\n \"framework-packages\": {}\n};\n\n/** Written for review by setup/sync; never used as a loader fallback. */\nexport const recommendedSeeds: Readonly<Record<string, ConfigObject>> = {\n \"max-method-lines\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"max-file-lines\": {\n \"mode\": \"NEW_AND_MODIFIED_FILES\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"require-return-type\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-inline-type-literals\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-any-unknown\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-implicit-any\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"prisma-validate-dtos\": {\n \"mode\": \"MODIFIED_CLASS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"prisma-converter\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-destructure\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"catch-error-pattern\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-unmanaged-exceptions\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"catch-must-propagate\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"forwards\": [\n \"error\",\n \"warn\",\n \"info\",\n \"debug\",\n \"trace\",\n \"reject\",\n \"handleError\",\n \"reportError\",\n \"captureException\"\n ]\n },\n \"angular-no-direct-api-in-resolver\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-symbol-di-tokens\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-client-creation-outside-server-or-client\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-custom-css\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-state-paths-in-templates\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-process-exit-outside-main\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-function-outside-class\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"inject-annotation-not-needed-for-concrete-class\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"framework-tag\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"role-tag\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"ensure-we-are-secure\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-inline-import-in-api-lib\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"one-enum-spelling-in-api-lib\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-utility-types-in-api-lib\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"paths\": [\n \"libraries/apis/**\"\n ]\n },\n \"required-type-suffix\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"entries\": [\n {\n \"paths\": [\n \"libraries/apis/**\"\n ],\n \"suffixes\": [\n \"Request\",\n \"Response\",\n \"Event\",\n \"Dto\",\n \"Api\"\n ],\n \"exempt\": false\n }\n ]\n },\n \"framework-tsconfig\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"framework-packages\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"entries\": [\n {\n \"packages\": [\n \"@angular/*\"\n ],\n \"frameworks\": [\n \"angular\"\n ]\n },\n {\n \"packages\": [\n \"react\",\n \"react-native\",\n \"expo*\",\n \"@expo/*\",\n \"@sentry/react-native\"\n ],\n \"frameworks\": [\n \"react\",\n \"react-native\"\n ]\n },\n {\n \"packages\": [\n \"express\",\n \"firebase-admin\",\n \"googleapis\",\n \"google-auth-library\",\n \"@google-cloud/*\"\n ],\n \"frameworks\": [\n \"node\",\n \"express\"\n ]\n },\n {\n \"packages\": [\n \"firebase\"\n ],\n \"frameworks\": [\n \"browser\",\n \"angular\",\n \"react\"\n ]\n }\n ]\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"rule-settings.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/rule-settings.ts"],"names":[],"mappings":";;;AAEA,oFAAoF;AACvE,QAAA,cAAc,GAA2C;IAClE,kBAAkB,EAAE;QAChB,OAAO,EAAE,EAAE;KACd;IACD,gBAAgB,EAAE;QACd,OAAO,EAAE,GAAG;KACf;IACD,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAA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Aa;gBAC1B,eAAe,EAAE,QAAQ;gBACzB,aAAa,EAAE;oBACX,gCAAgC;iBACnC;gBACD,eAAe,EAAE;oBACb,2CAA2C;iBAC9C;aACJ;YACD;gBACI,WAAW,EAAE,cAAc;gBAC3B,eAAe,EAAE,SAAS;gBAC1B,aAAa,EAAE;oBACX,0BAA0B;iBAC7B;gBACD,eAAe,EAAE;oBACb,kDAAkD;iBACrD;aACJ;SACJ;QACD,eAAe,EAAE,IAAI;QACrB,iBAAiB,EAAE,IAAI;QACvB,4BAA4B,EAAE,EAAE;KACnC;IACD,0BAA0B,EAAE;QACxB,MAAM,EAAE,mBAAmB;QAC3B,uBAAuB,EAAE,CAAC;QAC1B,0BAA0B,EAAE,IAAI;QAChC,cAAc,EAAE,oBAAoB;QACpC,eAAe,EAAE;YACb,iCAAiC;SACpC;QACD,kBAAkB,EAAE;YAChB,aAAa;YACb,cAAc;SACjB;QACD,eAAe,EAAE,IAAI;QACrB,iBAAiB,EAAE,IAAI;QACvB,uBAAuB,EAAE;YACrB,sCAAsC;SACzC;QACD,cAAc,EAAE,iDAAiD;QACjE,aAAa,EAAE,iDAAiD;QAChE,iBAAiB,EAAE,yBAAyB;QAC5C,iBAAiB,EAAE,MAAM;KAC5B;CACJ,CAAC","sourcesContent":["import { ConfigObject } from '@webpieces/rules-sdk';\n\n/** Optional knobs only. Required behaviour is always supplied by the repository. */\nexport const optionalTuning: Readonly<Record<string, ConfigObject>> = {\n \"max-method-lines\": {\n \"limit\": 80\n },\n \"max-file-lines\": {\n \"limit\": 900\n },\n \"require-return-type\": {},\n \"no-inline-type-literals\": {},\n \"no-any-unknown\": {},\n \"no-implicit-any\": {},\n \"prisma-validate-dtos\": {},\n \"prisma-converter\": {},\n \"no-destructure\": {\n \"allowTopLevel\": true\n },\n \"catch-error-pattern\": {},\n \"no-unmanaged-exceptions\": {},\n \"catch-must-propagate\": {},\n \"angular-no-direct-api-in-resolver\": {},\n \"no-symbol-di-tokens\": {},\n \"no-client-creation-outside-server-or-client\": {},\n \"no-custom-css\": {\n \"allowGlobs\": []\n },\n \"no-state-paths-in-templates\": {},\n \"no-process-exit-outside-main\": {},\n \"no-function-outside-class\": {},\n \"inject-annotation-not-needed-for-concrete-class\": {},\n \"framework-tag\": {\n \"knownTypes\": [\n \"browser\",\n \"react\",\n \"angular\",\n \"node\",\n \"express\",\n \"react-native\"\n ]\n },\n \"role-tag\": {\n \"knownTypes\": [\n \"server\",\n \"app\",\n \"bundle\",\n \"designed-lib\",\n \"lib\",\n \"client\",\n \"api-lib\",\n \"api-client\"\n ]\n },\n \"ensure-we-are-secure\": {},\n \"no-inline-import-in-api-lib\": {},\n \"one-enum-spelling-in-api-lib\": {},\n \"no-utility-types-in-api-lib\": {},\n \"required-type-suffix\": {},\n \"framework-tsconfig\": {},\n \"framework-packages\": {},\n \"ipc-boundary\": {},\n \"ipc-contract-shape\": {},\n \"ipc-pairing\": {},\n \"ipc-protocol-fingerprint\": {}\n};\n\n/** Written for review by setup/sync; never used as a loader fallback. */\nexport const recommendedSeeds: Readonly<Record<string, ConfigObject>> = {\n \"max-method-lines\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"max-file-lines\": {\n \"mode\": \"NEW_AND_MODIFIED_FILES\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"require-return-type\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-inline-type-literals\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-any-unknown\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-implicit-any\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"prisma-validate-dtos\": {\n \"mode\": \"MODIFIED_CLASS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"prisma-converter\": {\n \"mode\": \"NEW_AND_MODIFIED_METHODS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-destructure\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"catch-error-pattern\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-unmanaged-exceptions\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"catch-must-propagate\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"forwards\": [\n \"error\",\n \"warn\",\n \"info\",\n \"debug\",\n \"trace\",\n \"reject\",\n \"handleError\",\n \"reportError\",\n \"captureException\"\n ]\n },\n \"angular-no-direct-api-in-resolver\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-symbol-di-tokens\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-client-creation-outside-server-or-client\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-custom-css\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-state-paths-in-templates\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-process-exit-outside-main\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-function-outside-class\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"inject-annotation-not-needed-for-concrete-class\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"framework-tag\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"role-tag\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"ensure-we-are-secure\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-inline-import-in-api-lib\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"one-enum-spelling-in-api-lib\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"no-utility-types-in-api-lib\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"paths\": [\n \"libraries/apis/**\"\n ]\n },\n \"required-type-suffix\": {\n \"mode\": \"NEW_AND_MODIFIED_CODE\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"entries\": [\n {\n \"paths\": [\n \"libraries/apis/**\"\n ],\n \"suffixes\": [\n \"Request\",\n \"Response\",\n \"Event\",\n \"Dto\",\n \"Api\"\n ],\n \"exempt\": false\n }\n ]\n },\n \"framework-tsconfig\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null\n },\n \"framework-packages\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"entries\": [\n {\n \"packages\": [\n \"@angular/*\"\n ],\n \"frameworks\": [\n \"angular\"\n ]\n },\n {\n \"packages\": [\n \"react\",\n \"react-native\",\n \"expo*\",\n \"@expo/*\",\n \"@sentry/react-native\"\n ],\n \"frameworks\": [\n \"react\",\n \"react-native\"\n ]\n },\n {\n \"packages\": [\n \"express\",\n \"firebase-admin\",\n \"googleapis\",\n \"google-auth-library\",\n \"@google-cloud/*\"\n ],\n \"frameworks\": [\n \"node\",\n \"express\"\n ]\n },\n {\n \"packages\": [\n \"firebase\"\n ],\n \"frameworks\": [\n \"browser\",\n \"angular\",\n \"react\"\n ]\n }\n ]\n },\n \"ipc-boundary\": {\n \"mode\": \"NEW_AND_MODIFIED_FILES\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"tsconfigPath\": \"tsconfig.base.json\",\n \"transportFiles\": [\n \"apps/website/src/app/native/shell-transport.ts\",\n \"apps/shell/src/bridge/shell-transport.ts\"\n ],\n \"compositionFiles\": [\n \"apps/website/src/app/native/provide-native.ts\",\n \"apps/website/src/app/native/website-endpoints.ts\",\n \"apps/shell/src/bridge/native-endpoints.ts\"\n ],\n \"bootstrapFiles\": [\n \"apps/website/src/app/native/shell-bootstrap.ts\",\n \"apps/shell/src/bridge/native-bootstrap.ts\"\n ],\n \"testOnlyModuleSuffixes\": [\n \".spec-support\"\n ],\n \"retiredModules\": [],\n \"retiredIdentifiers\": [],\n \"forbiddenClassNamePatterns\": [\n \"To(Native|Website)Impl$\"\n ],\n \"legacyWireFile\": null,\n \"bootstrapAllowedLegacyNames\": [],\n \"legacyWireCommandPrefixes\": []\n },\n \"ipc-contract-shape\": {\n \"mode\": \"NEW_AND_MODIFIED_FILES\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"tsconfigPath\": \"tsconfig.base.json\",\n \"contractPaths\": [\n \"libraries/apis/shell-api/src/**\"\n ],\n \"apiClassSuffixes\": [\n \"ToNativeApi\",\n \"ToWebsiteApi\"\n ],\n \"requiredProjectTags\": [\n \"api:ipc-contract\",\n \"framework:browser\",\n \"framework:node\"\n ],\n \"forbiddenImportModules\": [\n \"@angular/*\",\n \"react\",\n \"react-native\",\n \"expo*\",\n \"@webpieces/ipc-bridge\"\n ],\n \"forbiddenImportPaths\": [\n \"apps/**\"\n ]\n },\n \"ipc-pairing\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"tsconfigPath\": \"tsconfig.base.json\",\n \"contractPaths\": [\n \"libraries/apis/shell-api/src/**\"\n ],\n \"directions\": [\n {\n \"apiSuffix\": \"ToNativeApi\",\n \"wireDirection\": \"native\",\n \"senderFiles\": [\n \"apps/website/src/app/native/**\"\n ],\n \"receiverFiles\": [\n \"apps/shell/src/bridge/native-endpoints.ts\"\n ]\n },\n {\n \"apiSuffix\": \"ToWebsiteApi\",\n \"wireDirection\": \"website\",\n \"senderFiles\": [\n \"apps/shell/src/bridge/**\"\n ],\n \"receiverFiles\": [\n \"apps/website/src/app/native/website-endpoints.ts\"\n ]\n }\n ],\n \"wireTableFile\": null,\n \"wireTableExport\": null,\n \"forbiddenDispatchVariables\": []\n },\n \"ipc-protocol-fingerprint\": {\n \"mode\": \"MODIFIED_PROJECTS\",\n \"turnOffRuleUntilEpoch\": 0,\n \"turnOffRuleWhileOnBranch\": null,\n \"tsconfigPath\": \"tsconfig.base.json\",\n \"contractPaths\": [\n \"libraries/apis/shell-api/src/**\"\n ],\n \"apiClassSuffixes\": [\n \"ToNativeApi\",\n \"ToWebsiteApi\"\n ],\n \"wireTableFile\": null,\n \"wireTableExport\": null,\n \"normalizedSourceFiles\": [\n \"libraries/apis/shell-api/src/*Api.ts\"\n ],\n \"manifestPath\": \"libraries/apis/shell-api/protocol-manifest.json\",\n \"versionFile\": \"libraries/apis/shell-api/src/bridge-protocol.ts\",\n \"versionConstant\": \"BRIDGE_PROTOCOL_VERSION\",\n \"withoutBaseline\": \"FAIL\"\n }\n};\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ipc-boundary` at the build gate (#1389) — see {@link IpcBoundaryAnalyzer} for what it refuses and
|
|
3
|
+
* `IpcBoundaryConfig` for its settings. Per FILE: NEW_AND_MODIFIED_FILES judges each changed production
|
|
4
|
+
* TypeScript file whole, MODIFIED_PROJECTS every file of a touched project, RUN_EVERY_TIME every file.
|
|
5
|
+
* Each file is parsed alone; no `ts.Program` is built.
|
|
6
|
+
*/
|
|
7
|
+
import { DiffScope } from '@webpieces/rules-config';
|
|
8
|
+
import { IpcBoundaryConfig } from './configs/ipc-configs';
|
|
9
|
+
import { CodeValidator, ExecutorResult } from './code-validator';
|
|
10
|
+
import { ProjectCatalog, ScanScope } from './scan-scope';
|
|
11
|
+
export declare class IpcBoundaryValidator extends CodeValidator<IpcBoundaryConfig> {
|
|
12
|
+
private readonly diffScope;
|
|
13
|
+
private readonly scanScope;
|
|
14
|
+
private readonly support;
|
|
15
|
+
constructor(config: IpcBoundaryConfig, diffScope: DiffScope, scanScope: ScanScope, catalog: ProjectCatalog);
|
|
16
|
+
run(workspaceRoot: string): Promise<ExecutorResult>;
|
|
17
|
+
/** The exported constants of `legacyWireFile` — the legacy raw wire names. */
|
|
18
|
+
private legacyNames;
|
|
19
|
+
private exportedConstants;
|
|
20
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `ipc-boundary` at the build gate (#1389) — see {@link IpcBoundaryAnalyzer} for what it refuses and
|
|
4
|
+
* `IpcBoundaryConfig` for its settings. Per FILE: NEW_AND_MODIFIED_FILES judges each changed production
|
|
5
|
+
* TypeScript file whole, MODIFIED_PROJECTS every file of a touched project, RUN_EVERY_TIME every file.
|
|
6
|
+
* Each file is parsed alone; no `ts.Program` is built.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.IpcBoundaryValidator = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
12
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
13
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
14
|
+
const inversify_1 = require("inversify");
|
|
15
|
+
const ipc_configs_1 = require("./configs/ipc-configs");
|
|
16
|
+
const code_validator_1 = require("./code-validator");
|
|
17
|
+
const scan_scope_1 = require("./scan-scope");
|
|
18
|
+
const ipc_boundary_analyzer_1 = require("./ipc/ipc-boundary-analyzer");
|
|
19
|
+
const ipc_rule_support_1 = require("./ipc/ipc-rule-support");
|
|
20
|
+
const ipc_source_1 = require("./ipc/ipc-source");
|
|
21
|
+
const RULE = 'ipc-boundary';
|
|
22
|
+
let IpcBoundaryValidator = class IpcBoundaryValidator extends code_validator_1.CodeValidator {
|
|
23
|
+
diffScope;
|
|
24
|
+
scanScope;
|
|
25
|
+
support;
|
|
26
|
+
constructor(config, diffScope, scanScope, catalog) {
|
|
27
|
+
super(config, RULE, RULE);
|
|
28
|
+
this.diffScope = diffScope;
|
|
29
|
+
this.scanScope = scanScope;
|
|
30
|
+
this.support = new ipc_rule_support_1.IpcRuleSupport(diffScope, catalog);
|
|
31
|
+
}
|
|
32
|
+
async run(workspaceRoot) {
|
|
33
|
+
const mode = this.config.mode;
|
|
34
|
+
if (mode === undefined || mode === 'OFF')
|
|
35
|
+
return { success: true };
|
|
36
|
+
const range = await this.diffScope.resolveBase(workspaceRoot);
|
|
37
|
+
if (range.base === undefined) {
|
|
38
|
+
console.log(`\n⏭️ Skipping ${RULE} validation (could not detect base branch)\n`);
|
|
39
|
+
return { success: true };
|
|
40
|
+
}
|
|
41
|
+
const reader = new ipc_source_1.IpcFileReader(workspaceRoot);
|
|
42
|
+
const files = (await this.scanScope.files(workspaceRoot, mode, range.base, range.head))
|
|
43
|
+
.filter((rel) => this.support.isProductionSource(rel) && reader.exists(rel));
|
|
44
|
+
if (files.length === 0)
|
|
45
|
+
return { success: true };
|
|
46
|
+
const options = new ipc_source_1.IpcCompilerOptionsReader().read(workspaceRoot, this.config.tsconfigPath);
|
|
47
|
+
const analyzer = new ipc_boundary_analyzer_1.IpcBoundaryAnalyzer(new ipc_boundary_analyzer_1.IpcBoundaryPolicy(this.config, this.legacyNames(reader)), new ipc_source_1.IpcModuleResolver(workspaceRoot, options));
|
|
48
|
+
const findings = [];
|
|
49
|
+
for (const rel of files) {
|
|
50
|
+
const file = reader.parse(rel);
|
|
51
|
+
if (file !== undefined)
|
|
52
|
+
findings.push(...analyzer.analyze(file));
|
|
53
|
+
}
|
|
54
|
+
if (findings.length === 0)
|
|
55
|
+
return { success: true };
|
|
56
|
+
this.scanScope.recordSites(RULE, findings.map((each) => each.relFile));
|
|
57
|
+
throw this.support.failure(RULE, 'raw IPC, the ipc-bridge factories and WebView delivery belong only to the registered transport / ' +
|
|
58
|
+
'composition / bootstrap modules (see the rule\'s config); feature code injects the generated shared API.', findings);
|
|
59
|
+
}
|
|
60
|
+
/** The exported constants of `legacyWireFile` — the legacy raw wire names. */
|
|
61
|
+
legacyNames(reader) {
|
|
62
|
+
const legacyFile = this.config.legacyWireFile;
|
|
63
|
+
if (legacyFile === null)
|
|
64
|
+
return new Set();
|
|
65
|
+
const file = reader.read(legacyFile);
|
|
66
|
+
if (file === undefined) {
|
|
67
|
+
throw new tooling_common_1.InformAiError(`${RULE}: legacyWireFile "${legacyFile}" does not exist. Point it at the file declaring the legacy ` +
|
|
68
|
+
'wire constants, or set it to null.');
|
|
69
|
+
}
|
|
70
|
+
return this.exportedConstants(file);
|
|
71
|
+
}
|
|
72
|
+
exportedConstants(file) {
|
|
73
|
+
const names = new Set();
|
|
74
|
+
for (const statement of file.source.statements) {
|
|
75
|
+
if (!ts.isVariableStatement(statement))
|
|
76
|
+
continue;
|
|
77
|
+
const exported = statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
|
|
78
|
+
if (exported !== true)
|
|
79
|
+
continue;
|
|
80
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
81
|
+
if (ts.isIdentifier(declaration.name))
|
|
82
|
+
names.add(declaration.name.text);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return names;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.IpcBoundaryValidator = IpcBoundaryValidator;
|
|
89
|
+
exports.IpcBoundaryValidator = IpcBoundaryValidator = tslib_1.__decorate([
|
|
90
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [ipc_configs_1.IpcBoundaryConfig,
|
|
92
|
+
rules_config_1.DiffScope,
|
|
93
|
+
scan_scope_1.ScanScope,
|
|
94
|
+
scan_scope_1.ProjectCatalog])
|
|
95
|
+
], IpcBoundaryValidator);
|
|
96
|
+
//# sourceMappingURL=validate-ipc-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-ipc-boundary.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-ipc-boundary.ts"],"names":[],"mappings":";AAA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wBAAS;QACT,sBAAS;QAC5B,2BAAc;GAPlB,oBAAoB,CAuEhC","sourcesContent":["/**\n * `ipc-boundary` at the build gate (#1389) — see {@link IpcBoundaryAnalyzer} for what it refuses and\n * `IpcBoundaryConfig` for its settings. Per FILE: NEW_AND_MODIFIED_FILES judges each changed production\n * TypeScript file whole, MODIFIED_PROJECTS every file of a touched project, RUN_EVERY_TIME every file.\n * Each file is parsed alone; no `ts.Program` is built.\n */\n\nimport * as ts from 'typescript';\nimport { DiffScope } from '@webpieces/rules-config';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { IpcBoundaryConfig } from './configs/ipc-configs';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { ProjectCatalog, ScanScope } from './scan-scope';\nimport { IpcBoundaryAnalyzer, IpcBoundaryPolicy } from './ipc/ipc-boundary-analyzer';\nimport { IpcRuleSupport } from './ipc/ipc-rule-support';\nimport { IpcCompilerOptionsReader, IpcFileReader, IpcFinding, IpcModuleResolver, IpcSourceFile } from './ipc/ipc-source';\n\nconst RULE = 'ipc-boundary';\n\n@injectable(bindingScopeValues.Singleton)\nexport class IpcBoundaryValidator extends CodeValidator<IpcBoundaryConfig> {\n private readonly support: IpcRuleSupport;\n\n constructor(\n config: IpcBoundaryConfig,\n private readonly diffScope: DiffScope,\n private readonly scanScope: ScanScope,\n catalog: ProjectCatalog,\n ) {\n super(config, RULE, RULE);\n this.support = new IpcRuleSupport(diffScope, catalog);\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n const mode = this.config.mode;\n if (mode === undefined || mode === 'OFF') return { success: true };\n const range = await this.diffScope.resolveBase(workspaceRoot);\n if (range.base === undefined) {\n console.log(`\\n⏭️ Skipping ${RULE} validation (could not detect base branch)\\n`);\n return { success: true };\n }\n const reader = new IpcFileReader(workspaceRoot);\n const files = (await this.scanScope.files(workspaceRoot, mode, range.base, range.head))\n .filter((rel: string) => this.support.isProductionSource(rel) && reader.exists(rel));\n if (files.length === 0) return { success: true };\n const options = new IpcCompilerOptionsReader().read(workspaceRoot, this.config.tsconfigPath);\n const analyzer = new IpcBoundaryAnalyzer(\n new IpcBoundaryPolicy(this.config, this.legacyNames(reader)),\n new IpcModuleResolver(workspaceRoot, options),\n );\n const findings: IpcFinding[] = [];\n for (const rel of files) {\n const file = reader.parse(rel);\n if (file !== undefined) findings.push(...analyzer.analyze(file));\n }\n if (findings.length === 0) return { success: true };\n this.scanScope.recordSites(RULE, findings.map((each: IpcFinding) => each.relFile));\n throw this.support.failure(\n RULE,\n 'raw IPC, the ipc-bridge factories and WebView delivery belong only to the registered transport / ' +\n 'composition / bootstrap modules (see the rule\\'s config); feature code injects the generated shared API.',\n findings,\n );\n }\n\n /** The exported constants of `legacyWireFile` — the legacy raw wire names. */\n private legacyNames(reader: IpcFileReader): Set<string> {\n const legacyFile = this.config.legacyWireFile;\n if (legacyFile === null) return new Set<string>();\n const file = reader.read(legacyFile);\n if (file === undefined) {\n throw new InformAiError(\n `${RULE}: legacyWireFile \"${legacyFile}\" does not exist. Point it at the file declaring the legacy ` +\n 'wire constants, or set it to null.',\n );\n }\n return this.exportedConstants(file);\n }\n\n private exportedConstants(file: IpcSourceFile): Set<string> {\n const names = new Set<string>();\n for (const statement of file.source.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n const exported = statement.modifiers?.some((modifier: ts.ModifierLike) => modifier.kind === ts.SyntaxKind.ExportKeyword);\n if (exported !== true) continue;\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name)) names.add(declaration.name.text);\n }\n }\n return names;\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ipc-contract-shape` at the build gate (#1389) — see {@link IpcContractShapeAnalyzer} for what it
|
|
3
|
+
* refuses. Per FILE, over the `contractPaths` files the mode selects; each file is parsed alone. The
|
|
4
|
+
* project owning a judged contract file must also carry every `requiredProjectTags` tag.
|
|
5
|
+
*/
|
|
6
|
+
import { DiffScope } from '@webpieces/rules-config';
|
|
7
|
+
import { IpcContractShapeConfig } from './configs/ipc-configs';
|
|
8
|
+
import { CodeValidator, ExecutorResult } from './code-validator';
|
|
9
|
+
import { ProjectCatalog, ScanScope } from './scan-scope';
|
|
10
|
+
export declare class IpcContractShapeValidator extends CodeValidator<IpcContractShapeConfig> {
|
|
11
|
+
private readonly diffScope;
|
|
12
|
+
private readonly scanScope;
|
|
13
|
+
private readonly catalog;
|
|
14
|
+
private readonly support;
|
|
15
|
+
constructor(config: IpcContractShapeConfig, diffScope: DiffScope, scanScope: ScanScope, catalog: ProjectCatalog);
|
|
16
|
+
run(workspaceRoot: string): Promise<ExecutorResult>;
|
|
17
|
+
/** One finding per owning project missing a required tag. */
|
|
18
|
+
private judgeTags;
|
|
19
|
+
private tagsOf;
|
|
20
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `ipc-contract-shape` at the build gate (#1389) — see {@link IpcContractShapeAnalyzer} for what it
|
|
4
|
+
* refuses. Per FILE, over the `contractPaths` files the mode selects; each file is parsed alone. The
|
|
5
|
+
* project owning a judged contract file must also carry every `requiredProjectTags` tag.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.IpcContractShapeValidator = void 0;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
12
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
13
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
14
|
+
const to_error_1 = require("@webpieces/tooling-common/to-error");
|
|
15
|
+
const inversify_1 = require("inversify");
|
|
16
|
+
const ipc_configs_1 = require("./configs/ipc-configs");
|
|
17
|
+
const code_validator_1 = require("./code-validator");
|
|
18
|
+
const scan_scope_1 = require("./scan-scope");
|
|
19
|
+
const ipc_contract_shape_analyzer_1 = require("./ipc/ipc-contract-shape-analyzer");
|
|
20
|
+
const ipc_rule_support_1 = require("./ipc/ipc-rule-support");
|
|
21
|
+
const ipc_source_1 = require("./ipc/ipc-source");
|
|
22
|
+
const RULE = 'ipc-contract-shape';
|
|
23
|
+
let IpcContractShapeValidator = class IpcContractShapeValidator extends code_validator_1.CodeValidator {
|
|
24
|
+
diffScope;
|
|
25
|
+
scanScope;
|
|
26
|
+
catalog;
|
|
27
|
+
support;
|
|
28
|
+
constructor(config, diffScope, scanScope, catalog) {
|
|
29
|
+
super(config, RULE, RULE);
|
|
30
|
+
this.diffScope = diffScope;
|
|
31
|
+
this.scanScope = scanScope;
|
|
32
|
+
this.catalog = catalog;
|
|
33
|
+
this.support = new ipc_rule_support_1.IpcRuleSupport(diffScope, catalog);
|
|
34
|
+
}
|
|
35
|
+
async run(workspaceRoot) {
|
|
36
|
+
const mode = this.config.mode;
|
|
37
|
+
if (mode === undefined || mode === 'OFF')
|
|
38
|
+
return { success: true };
|
|
39
|
+
const range = await this.diffScope.resolveBase(workspaceRoot);
|
|
40
|
+
if (range.base === undefined) {
|
|
41
|
+
console.log(`\n⏭️ Skipping ${RULE} validation (could not detect base branch)\n`);
|
|
42
|
+
return { success: true };
|
|
43
|
+
}
|
|
44
|
+
const reader = new ipc_source_1.IpcFileReader(workspaceRoot);
|
|
45
|
+
const files = (await this.scanScope.files(workspaceRoot, mode, range.base, range.head)).filter((rel) => this.support.isProductionSource(rel) && (0, rules_config_1.matchesAnyGlob)(rel, this.config.contractPaths) && reader.exists(rel));
|
|
46
|
+
if (files.length === 0)
|
|
47
|
+
return { success: true };
|
|
48
|
+
const options = new ipc_source_1.IpcCompilerOptionsReader().read(workspaceRoot, this.config.tsconfigPath);
|
|
49
|
+
const analyzer = new ipc_contract_shape_analyzer_1.IpcContractShapeAnalyzer(this.config, new ipc_source_1.IpcModuleResolver(workspaceRoot, options));
|
|
50
|
+
const findings = [...(await this.judgeTags(workspaceRoot, files))];
|
|
51
|
+
for (const rel of files) {
|
|
52
|
+
const file = reader.parse(rel);
|
|
53
|
+
if (file !== undefined)
|
|
54
|
+
findings.push(...analyzer.analyze(file));
|
|
55
|
+
}
|
|
56
|
+
if (findings.length === 0)
|
|
57
|
+
return { success: true };
|
|
58
|
+
this.scanScope.recordSites(RULE, findings.map((each) => each.relFile));
|
|
59
|
+
throw this.support.failure(RULE, 'a shared IPC contract is abstract directional APIs, named DTOs and explicit @WpInternal / ' +
|
|
60
|
+
'@WpIpcEndpoint / @MaskLog metadata — nothing host-, factory- or endpoint-specific.', findings);
|
|
61
|
+
}
|
|
62
|
+
/** One finding per owning project missing a required tag. */
|
|
63
|
+
async judgeTags(workspaceRoot, files) {
|
|
64
|
+
const required = this.config.requiredProjectTags;
|
|
65
|
+
if (required.length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
const owners = new Map();
|
|
68
|
+
for (const rel of files) {
|
|
69
|
+
const owner = await this.catalog.ownerOf(workspaceRoot, rel);
|
|
70
|
+
if (owner !== undefined)
|
|
71
|
+
owners.set(owner.dir, owner);
|
|
72
|
+
}
|
|
73
|
+
const out = [];
|
|
74
|
+
for (const owner of owners.values()) {
|
|
75
|
+
const projectJson = owner.dir === '' ? 'project.json' : `${owner.dir}/project.json`;
|
|
76
|
+
const tags = this.tagsOf(path.join(workspaceRoot, projectJson));
|
|
77
|
+
const missing = required.filter((tag) => !tags.includes(tag));
|
|
78
|
+
if (missing.length === 0)
|
|
79
|
+
continue;
|
|
80
|
+
out.push(new ipc_source_1.IpcFinding(projectJson, 1, `tags: [${tags.map((tag) => JSON.stringify(tag)).join(', ')}]`, `The shared IPC library ${owner.name} must carry ${required.join(', ')} (missing ${missing.join(', ')}).`));
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
tagsOf(absFile) {
|
|
85
|
+
// webpieces-disable no-unmanaged-exceptions -- add the exact project.json path while preserving the parse/read failure as cause
|
|
86
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions
|
|
87
|
+
try {
|
|
88
|
+
const parsed = JSON.parse(fs.readFileSync(absFile, 'utf-8'));
|
|
89
|
+
return Array.isArray(parsed.tags) ? parsed.tags.filter((tag) => typeof tag === 'string') : [];
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
const error = (0, to_error_1.toError)(err);
|
|
93
|
+
throw new tooling_common_1.InformAiError(`${RULE}: cannot read tags from ${absFile} — fix project.json and retry.`, { cause: error });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.IpcContractShapeValidator = IpcContractShapeValidator;
|
|
98
|
+
exports.IpcContractShapeValidator = IpcContractShapeValidator = tslib_1.__decorate([
|
|
99
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
100
|
+
tslib_1.__metadata("design:paramtypes", [ipc_configs_1.IpcContractShapeConfig,
|
|
101
|
+
rules_config_1.DiffScope,
|
|
102
|
+
scan_scope_1.ScanScope,
|
|
103
|
+
scan_scope_1.ProjectCatalog])
|
|
104
|
+
], IpcContractShapeValidator);
|
|
105
|
+
//# sourceMappingURL=validate-ipc-contract-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-ipc-contract-shape.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-ipc-contract-shape.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAoE;AACpE,8DAA0D;AAC1D,iEAA6D;AAC7D,yCAA2D;AAC3D,uDAA+D;AAC/D,qDAAiE;AACjE,6CAAuE;AACvE,mFAA6E;AAC7E,6DAAwD;AACxD,iDAA0G;AAE1G,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAM3B,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,8BAAqC;IAK3D;IACA;IACA;IANJ,OAAO,CAAiB;IAEzC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EO,MAAM,CAAC,OAAe;QAC1B,gIAAgI;QAChI,8DAA8D;QAC9D,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAmB,CAAC;YAC/E,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1G,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,IAAI,8BAAa,CAAC,GAAG,IAAI,2BAA2B,OAAO,gCAAgC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACzH,CAAC;IACL,CAAC;CACJ,CAAA;AAhFY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAKzB,oCAAsB;QACF,wBAAS;QACT,sBAAS;QACX,2BAAc;GAPnC,yBAAyB,CAgFrC","sourcesContent":["/**\n * `ipc-contract-shape` at the build gate (#1389) — see {@link IpcContractShapeAnalyzer} for what it\n * refuses. Per FILE, over the `contractPaths` files the mode selects; each file is parsed alone. The\n * project owning a judged contract file must also carry every `requiredProjectTags` tag.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { DiffScope, matchesAnyGlob } from '@webpieces/rules-config';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { IpcContractShapeConfig } from './configs/ipc-configs';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { ProjectCatalog, ProjectEntry, ScanScope } from './scan-scope';\nimport { IpcContractShapeAnalyzer } from './ipc/ipc-contract-shape-analyzer';\nimport { IpcRuleSupport } from './ipc/ipc-rule-support';\nimport { IpcCompilerOptionsReader, IpcFileReader, IpcFinding, IpcModuleResolver } from './ipc/ipc-source';\n\nconst RULE = 'ipc-contract-shape';\n\n/** The only field of a project.json this reads. */\ntype RawProjectTags = { tags?: string[] };\n\n@injectable(bindingScopeValues.Singleton)\nexport class IpcContractShapeValidator extends CodeValidator<IpcContractShapeConfig> {\n private readonly support: IpcRuleSupport;\n\n constructor(\n config: IpcContractShapeConfig,\n private readonly diffScope: DiffScope,\n private readonly scanScope: ScanScope,\n private readonly catalog: ProjectCatalog,\n ) {\n super(config, RULE, RULE);\n this.support = new IpcRuleSupport(diffScope, catalog);\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n const mode = this.config.mode;\n if (mode === undefined || mode === 'OFF') return { success: true };\n const range = await this.diffScope.resolveBase(workspaceRoot);\n if (range.base === undefined) {\n console.log(`\\n⏭️ Skipping ${RULE} validation (could not detect base branch)\\n`);\n return { success: true };\n }\n const reader = new IpcFileReader(workspaceRoot);\n const files = (await this.scanScope.files(workspaceRoot, mode, range.base, range.head)).filter(\n (rel: string) =>\n this.support.isProductionSource(rel) && matchesAnyGlob(rel, this.config.contractPaths) && reader.exists(rel),\n );\n if (files.length === 0) return { success: true };\n const options = new IpcCompilerOptionsReader().read(workspaceRoot, this.config.tsconfigPath);\n const analyzer = new IpcContractShapeAnalyzer(this.config, new IpcModuleResolver(workspaceRoot, options));\n const findings: IpcFinding[] = [...(await this.judgeTags(workspaceRoot, files))];\n for (const rel of files) {\n const file = reader.parse(rel);\n if (file !== undefined) findings.push(...analyzer.analyze(file));\n }\n if (findings.length === 0) return { success: true };\n this.scanScope.recordSites(RULE, findings.map((each: IpcFinding) => each.relFile));\n throw this.support.failure(\n RULE,\n 'a shared IPC contract is abstract directional APIs, named DTOs and explicit @WpInternal / ' +\n '@WpIpcEndpoint / @MaskLog metadata — nothing host-, factory- or endpoint-specific.',\n findings,\n );\n }\n\n /** One finding per owning project missing a required tag. */\n private async judgeTags(workspaceRoot: string, files: readonly string[]): Promise<IpcFinding[]> {\n const required = this.config.requiredProjectTags;\n if (required.length === 0) return [];\n const owners = new Map<string, ProjectEntry>();\n for (const rel of files) {\n const owner = await this.catalog.ownerOf(workspaceRoot, rel);\n if (owner !== undefined) owners.set(owner.dir, owner);\n }\n const out: IpcFinding[] = [];\n for (const owner of owners.values()) {\n const projectJson = owner.dir === '' ? 'project.json' : `${owner.dir}/project.json`;\n const tags = this.tagsOf(path.join(workspaceRoot, projectJson));\n const missing = required.filter((tag: string) => !tags.includes(tag));\n if (missing.length === 0) continue;\n out.push(new IpcFinding(\n projectJson,\n 1,\n `tags: [${tags.map((tag: string) => JSON.stringify(tag)).join(', ')}]`,\n `The shared IPC library ${owner.name} must carry ${required.join(', ')} (missing ${missing.join(', ')}).`,\n ));\n }\n return out;\n }\n\n private tagsOf(absFile: string): string[] {\n // webpieces-disable no-unmanaged-exceptions -- add the exact project.json path while preserving the parse/read failure as cause\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const parsed = JSON.parse(fs.readFileSync(absFile, 'utf-8')) as RawProjectTags;\n return Array.isArray(parsed.tags) ? parsed.tags.filter((tag: string) => typeof tag === 'string') : [];\n } catch (err: unknown) {\n const error = toError(err);\n throw new InformAiError(`${RULE}: cannot read tags from ${absFile} — fix project.json and retry.`, { cause: error });\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ipc-pairing` at the build gate (#1389) — see {@link IpcPairingAnalyzer} for what it checks. Project
|
|
3
|
+
* scoped: under MODIFIED_PROJECTS it runs when the diff touches a configured IPC file or a project owning
|
|
4
|
+
* one, and then judges the whole IPC file set. The only `ts.Program` is rooted at `contractPaths`.
|
|
5
|
+
*/
|
|
6
|
+
import { DiffScope } from '@webpieces/rules-config';
|
|
7
|
+
import { IpcPairingConfig } from './configs/ipc-configs';
|
|
8
|
+
import { CodeValidator, ExecutorResult } from './code-validator';
|
|
9
|
+
import { ProjectCatalog, ScanScope } from './scan-scope';
|
|
10
|
+
export declare class IpcPairingValidator extends CodeValidator<IpcPairingConfig> {
|
|
11
|
+
private readonly scanScope;
|
|
12
|
+
private readonly support;
|
|
13
|
+
constructor(config: IpcPairingConfig, scanScope: ScanScope, diffScope: DiffScope, catalog: ProjectCatalog);
|
|
14
|
+
run(workspaceRoot: string): Promise<ExecutorResult>;
|
|
15
|
+
private triggerGlobs;
|
|
16
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `ipc-pairing` at the build gate (#1389) — see {@link IpcPairingAnalyzer} for what it checks. Project
|
|
4
|
+
* scoped: under MODIFIED_PROJECTS it runs when the diff touches a configured IPC file or a project owning
|
|
5
|
+
* one, and then judges the whole IPC file set. The only `ts.Program` is rooted at `contractPaths`.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.IpcPairingValidator = void 0;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
11
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
12
|
+
const inversify_1 = require("inversify");
|
|
13
|
+
const ipc_configs_1 = require("./configs/ipc-configs");
|
|
14
|
+
const code_validator_1 = require("./code-validator");
|
|
15
|
+
const scan_scope_1 = require("./scan-scope");
|
|
16
|
+
const ipc_contract_inventory_1 = require("./ipc/ipc-contract-inventory");
|
|
17
|
+
const ipc_controller_resolver_1 = require("./ipc/ipc-controller-resolver");
|
|
18
|
+
const ipc_pairing_analyzer_1 = require("./ipc/ipc-pairing-analyzer");
|
|
19
|
+
const ipc_rule_support_1 = require("./ipc/ipc-rule-support");
|
|
20
|
+
const ipc_source_1 = require("./ipc/ipc-source");
|
|
21
|
+
const RULE = 'ipc-pairing';
|
|
22
|
+
let IpcPairingValidator = class IpcPairingValidator extends code_validator_1.CodeValidator {
|
|
23
|
+
scanScope;
|
|
24
|
+
support;
|
|
25
|
+
constructor(config, scanScope, diffScope, catalog) {
|
|
26
|
+
super(config, RULE, RULE);
|
|
27
|
+
this.scanScope = scanScope;
|
|
28
|
+
this.support = new ipc_rule_support_1.IpcRuleSupport(diffScope, catalog);
|
|
29
|
+
}
|
|
30
|
+
async run(workspaceRoot) {
|
|
31
|
+
const mode = this.config.mode;
|
|
32
|
+
if (mode === undefined || mode === 'OFF')
|
|
33
|
+
return { success: true };
|
|
34
|
+
const wireTable = new ipc_contract_inventory_1.IpcWireTableConfig().of(RULE, this.config.wireTableFile, this.config.wireTableExport);
|
|
35
|
+
if (!(await this.support.triggered(workspaceRoot, mode, RULE, this.triggerGlobs())))
|
|
36
|
+
return { success: true };
|
|
37
|
+
const sourceFiles = await this.support.sourceFiles(workspaceRoot);
|
|
38
|
+
const contractFiles = await this.support.sourceFilesMatching(workspaceRoot, this.config.contractPaths);
|
|
39
|
+
if (contractFiles.length === 0) {
|
|
40
|
+
throw new tooling_common_1.InformAiError(`${RULE}: no source file matches "contractPaths" ${JSON.stringify(this.config.contractPaths)}.`);
|
|
41
|
+
}
|
|
42
|
+
const options = new ipc_source_1.IpcCompilerOptionsReader().read(workspaceRoot, this.config.tsconfigPath);
|
|
43
|
+
const suffixes = this.config.directions.map((direction) => direction.apiSuffix);
|
|
44
|
+
const inventory = new ipc_contract_inventory_1.IpcContractInventoryReader().read(workspaceRoot, options, contractFiles, suffixes, wireTable);
|
|
45
|
+
const reader = new ipc_source_1.IpcFileReader(workspaceRoot);
|
|
46
|
+
const controllers = new ipc_controller_resolver_1.IpcControllerResolver(reader, new ipc_source_1.IpcModuleResolver(workspaceRoot, options), this.config.contractPaths);
|
|
47
|
+
const findings = new ipc_pairing_analyzer_1.IpcPairingAnalyzer(this.config, reader, controllers).analyze(inventory, sourceFiles);
|
|
48
|
+
if (findings.length === 0)
|
|
49
|
+
return { success: true };
|
|
50
|
+
this.scanScope.recordSites(RULE, findings.map((each) => each.relFile));
|
|
51
|
+
throw this.support.failure(RULE, 'every shared directional API needs a generated client at its sender and exactly one framework ' +
|
|
52
|
+
'registration at its receiver, whose controller extends that same shared API.', findings);
|
|
53
|
+
}
|
|
54
|
+
triggerGlobs() {
|
|
55
|
+
const globs = [...this.config.contractPaths];
|
|
56
|
+
for (const direction of this.config.directions)
|
|
57
|
+
globs.push(...direction.senderFiles, ...direction.receiverFiles);
|
|
58
|
+
if (this.config.wireTableFile !== null)
|
|
59
|
+
globs.push(this.config.wireTableFile);
|
|
60
|
+
return globs;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.IpcPairingValidator = IpcPairingValidator;
|
|
64
|
+
exports.IpcPairingValidator = IpcPairingValidator = tslib_1.__decorate([
|
|
65
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
66
|
+
tslib_1.__metadata("design:paramtypes", [ipc_configs_1.IpcPairingConfig,
|
|
67
|
+
scan_scope_1.ScanScope,
|
|
68
|
+
rules_config_1.DiffScope,
|
|
69
|
+
scan_scope_1.ProjectCatalog])
|
|
70
|
+
], IpcPairingValidator);
|
|
71
|
+
//# sourceMappingURL=validate-ipc-pairing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-ipc-pairing.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-ipc-pairing.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,0DAAoD;AACpD,8DAA0D;AAC1D,yCAA2D;AAC3D,uDAA4E;AAC5E,qDAAiE;AACjE,6CAAyD;AACzD,yEAA8F;AAC9F,2EAAsE;AACtE,qEAAgE;AAChE,6DAAwD;AACxD,iDAA0G;AAE1G,MAAM,IAAI,GAAG,aAAa,CAAC;AAGpB,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,8BAA+B;IAK/C;IAJJ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AC,IAAI,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;QACjH,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,KAAK,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC9E,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AA7CY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAKzB,8BAAgB;QACI,sBAAS;QAC1B,wBAAS;QACX,2BAAc;GAPlB,mBAAmB,CA6C/B","sourcesContent":["/**\n * `ipc-pairing` at the build gate (#1389) — see {@link IpcPairingAnalyzer} for what it checks. Project\n * scoped: under MODIFIED_PROJECTS it runs when the diff touches a configured IPC file or a project owning\n * one, and then judges the whole IPC file set. The only `ts.Program` is rooted at `contractPaths`.\n */\n\nimport { DiffScope } from '@webpieces/rules-config';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { IpcDirectionEntry, IpcPairingConfig } from './configs/ipc-configs';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { ProjectCatalog, ScanScope } from './scan-scope';\nimport { IpcContractInventoryReader, IpcWireTableConfig } from './ipc/ipc-contract-inventory';\nimport { IpcControllerResolver } from './ipc/ipc-controller-resolver';\nimport { IpcPairingAnalyzer } from './ipc/ipc-pairing-analyzer';\nimport { IpcRuleSupport } from './ipc/ipc-rule-support';\nimport { IpcCompilerOptionsReader, IpcFileReader, IpcFinding, IpcModuleResolver } from './ipc/ipc-source';\n\nconst RULE = 'ipc-pairing';\n\n@injectable(bindingScopeValues.Singleton)\nexport class IpcPairingValidator extends CodeValidator<IpcPairingConfig> {\n private readonly support: IpcRuleSupport;\n\n constructor(\n config: IpcPairingConfig,\n private readonly scanScope: ScanScope,\n diffScope: DiffScope,\n catalog: ProjectCatalog,\n ) {\n super(config, RULE, RULE);\n this.support = new IpcRuleSupport(diffScope, catalog);\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n const mode = this.config.mode;\n if (mode === undefined || mode === 'OFF') return { success: true };\n const wireTable = new IpcWireTableConfig().of(RULE, this.config.wireTableFile, this.config.wireTableExport);\n if (!(await this.support.triggered(workspaceRoot, mode, RULE, this.triggerGlobs()))) return { success: true };\n const sourceFiles = await this.support.sourceFiles(workspaceRoot);\n const contractFiles = await this.support.sourceFilesMatching(workspaceRoot, this.config.contractPaths);\n if (contractFiles.length === 0) {\n throw new InformAiError(`${RULE}: no source file matches \"contractPaths\" ${JSON.stringify(this.config.contractPaths)}.`);\n }\n const options = new IpcCompilerOptionsReader().read(workspaceRoot, this.config.tsconfigPath);\n const suffixes = this.config.directions.map((direction: IpcDirectionEntry) => direction.apiSuffix);\n const inventory = new IpcContractInventoryReader().read(workspaceRoot, options, contractFiles, suffixes, wireTable);\n const reader = new IpcFileReader(workspaceRoot);\n const controllers = new IpcControllerResolver(reader, new IpcModuleResolver(workspaceRoot, options), this.config.contractPaths);\n const findings = new IpcPairingAnalyzer(this.config, reader, controllers).analyze(inventory, sourceFiles);\n if (findings.length === 0) return { success: true };\n this.scanScope.recordSites(RULE, findings.map((each: IpcFinding) => each.relFile));\n throw this.support.failure(\n RULE,\n 'every shared directional API needs a generated client at its sender and exactly one framework ' +\n 'registration at its receiver, whose controller extends that same shared API.',\n findings,\n );\n }\n\n private triggerGlobs(): string[] {\n const globs = [...this.config.contractPaths];\n for (const direction of this.config.directions) globs.push(...direction.senderFiles, ...direction.receiverFiles);\n if (this.config.wireTableFile !== null) globs.push(this.config.wireTableFile);\n return globs;\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ipc-protocol-fingerprint` at the build gate (#1389). Project scoped like `ipc-pairing`: under
|
|
3
|
+
* MODIFIED_PROJECTS it runs when the diff touches a configured IPC file or a project owning one. It
|
|
4
|
+
* recomputes the fingerprint (contract-rooted program only), compares it with the committed manifest, and
|
|
5
|
+
* with the manifest at the branch base (merge-base with main, or NX_BASE), so the protocol can neither
|
|
6
|
+
* decrease nor stay put across a wire change. `pnpm wp-ipc-record-protocol` re-records the manifest.
|
|
7
|
+
*/
|
|
8
|
+
import { DiffScope } from '@webpieces/rules-config';
|
|
9
|
+
import { GitProcessApi } from '@webpieces/tooling-common';
|
|
10
|
+
import { IpcProtocolFingerprintConfig } from './configs/ipc-configs';
|
|
11
|
+
import { CodeValidator, ExecutorResult } from './code-validator';
|
|
12
|
+
import { ProjectCatalog } from './scan-scope';
|
|
13
|
+
export declare class IpcProtocolFingerprintValidator extends CodeValidator<IpcProtocolFingerprintConfig> {
|
|
14
|
+
private readonly diffScope;
|
|
15
|
+
private readonly git;
|
|
16
|
+
private readonly support;
|
|
17
|
+
private readonly recorder;
|
|
18
|
+
constructor(config: IpcProtocolFingerprintConfig, diffScope: DiffScope, catalog: ProjectCatalog, git: GitProcessApi);
|
|
19
|
+
run(workspaceRoot: string): Promise<ExecutorResult>;
|
|
20
|
+
/** The branch base's manifest; without a base, FAIL refuses and VERIFY_COMMITTED skips the increment check. */
|
|
21
|
+
private baseline;
|
|
22
|
+
private triggerGlobs;
|
|
23
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `ipc-protocol-fingerprint` at the build gate (#1389). Project scoped like `ipc-pairing`: under
|
|
4
|
+
* MODIFIED_PROJECTS it runs when the diff touches a configured IPC file or a project owning one. It
|
|
5
|
+
* recomputes the fingerprint (contract-rooted program only), compares it with the committed manifest, and
|
|
6
|
+
* with the manifest at the branch base (merge-base with main, or NX_BASE), so the protocol can neither
|
|
7
|
+
* decrease nor stay put across a wire change. `pnpm wp-ipc-record-protocol` re-records the manifest.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.IpcProtocolFingerprintValidator = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
13
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
14
|
+
const inversify_1 = require("inversify");
|
|
15
|
+
const ipc_configs_1 = require("./configs/ipc-configs");
|
|
16
|
+
const code_validator_1 = require("./code-validator");
|
|
17
|
+
const scan_scope_1 = require("./scan-scope");
|
|
18
|
+
const ipc_protocol_fingerprint_1 = require("./ipc/ipc-protocol-fingerprint");
|
|
19
|
+
const ipc_protocol_recorder_1 = require("./ipc/ipc-protocol-recorder");
|
|
20
|
+
const ipc_rule_support_1 = require("./ipc/ipc-rule-support");
|
|
21
|
+
const ipc_source_1 = require("./ipc/ipc-source");
|
|
22
|
+
let IpcProtocolFingerprintValidator = class IpcProtocolFingerprintValidator extends code_validator_1.CodeValidator {
|
|
23
|
+
diffScope;
|
|
24
|
+
git;
|
|
25
|
+
support;
|
|
26
|
+
recorder;
|
|
27
|
+
constructor(config, diffScope, catalog, git) {
|
|
28
|
+
super(config, ipc_protocol_recorder_1.IPC_FINGERPRINT_RULE, ipc_protocol_recorder_1.IPC_FINGERPRINT_RULE);
|
|
29
|
+
this.diffScope = diffScope;
|
|
30
|
+
this.git = git;
|
|
31
|
+
this.support = new ipc_rule_support_1.IpcRuleSupport(diffScope, catalog);
|
|
32
|
+
this.recorder = new ipc_protocol_recorder_1.IpcProtocolRecorder(this.support);
|
|
33
|
+
}
|
|
34
|
+
async run(workspaceRoot) {
|
|
35
|
+
const mode = this.config.mode;
|
|
36
|
+
if (mode === undefined || mode === 'OFF')
|
|
37
|
+
return { success: true };
|
|
38
|
+
if (!(await this.support.triggered(workspaceRoot, mode, ipc_protocol_recorder_1.IPC_FINGERPRINT_RULE, this.triggerGlobs()))) {
|
|
39
|
+
return { success: true };
|
|
40
|
+
}
|
|
41
|
+
const current = await this.recorder.current(workspaceRoot, this.config);
|
|
42
|
+
const committed = this.recorder.committed(workspaceRoot, this.config);
|
|
43
|
+
const base = await this.baseline(workspaceRoot);
|
|
44
|
+
const errors = new ipc_protocol_fingerprint_1.IpcProtocolComparison(this.config.versionConstant, ipc_protocol_recorder_1.IPC_RECORD_COMMAND).compare(current, committed, base);
|
|
45
|
+
if (errors.length === 0)
|
|
46
|
+
return { success: true };
|
|
47
|
+
const findings = errors.map((error) => new ipc_source_1.IpcFinding(this.config.manifestPath, 1, `protocol ${current.protocol}, fingerprint ${current.fingerprint}`, error));
|
|
48
|
+
throw this.support.failure(ipc_protocol_recorder_1.IPC_FINGERPRINT_RULE, `the recorded wire fingerprint must match the source, and a wire change must raise ${this.config.versionConstant}.`, findings);
|
|
49
|
+
}
|
|
50
|
+
/** The branch base's manifest; without a base, FAIL refuses and VERIFY_COMMITTED skips the increment check. */
|
|
51
|
+
async baseline(workspaceRoot) {
|
|
52
|
+
const range = await this.diffScope.resolveBase(workspaceRoot);
|
|
53
|
+
if (range.base !== undefined)
|
|
54
|
+
return this.recorder.atBase(workspaceRoot, this.config, range.base, this.git);
|
|
55
|
+
if (this.config.withoutBaseline === 'VERIFY_COMMITTED') {
|
|
56
|
+
console.log(`\nℹ️ ${ipc_protocol_recorder_1.IPC_FINGERPRINT_RULE}: no branch base; verifying the committed manifest only.\n`);
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
throw this.support.failure(ipc_protocol_recorder_1.IPC_FINGERPRINT_RULE, 'the protocol increment cannot be checked without the branch base.', [
|
|
60
|
+
new ipc_source_1.IpcFinding(this.config.manifestPath, 1, '', 'IPC protocol baseline lookup failed: no merge-base with origin/main or main. Fetch origin main (or set ' +
|
|
61
|
+
'NX_BASE) and retry; an archive/shallow build checkout configures withoutBaseline: "VERIFY_COMMITTED".'),
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
triggerGlobs() {
|
|
65
|
+
const globs = [...this.config.contractPaths, ...this.config.normalizedSourceFiles, this.config.versionFile, this.config.manifestPath];
|
|
66
|
+
if (this.config.wireTableFile !== null)
|
|
67
|
+
globs.push(this.config.wireTableFile);
|
|
68
|
+
return globs;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.IpcProtocolFingerprintValidator = IpcProtocolFingerprintValidator;
|
|
72
|
+
exports.IpcProtocolFingerprintValidator = IpcProtocolFingerprintValidator = tslib_1.__decorate([
|
|
73
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
74
|
+
tslib_1.__metadata("design:paramtypes", [ipc_configs_1.IpcProtocolFingerprintConfig,
|
|
75
|
+
rules_config_1.DiffScope,
|
|
76
|
+
scan_scope_1.ProjectCatalog,
|
|
77
|
+
tooling_common_1.GitProcessApi])
|
|
78
|
+
], IpcProtocolFingerprintValidator);
|
|
79
|
+
//# sourceMappingURL=validate-ipc-protocol-fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-ipc-protocol-fingerprint.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-ipc-protocol-fingerprint.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,0DAAoD;AACpD,8DAA0D;AAC1D,yCAA2D;AAC3D,uDAAqE;AACrE,qDAAiE;AACjE,6CAA8C;AAC9C,6EAA4F;AAC5F,uEAA4G;AAC5G,6DAAwD;AACxD,iDAA8C;AAGvC,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,8BAA2C;IAMvE;IAEA;IAPJ,OAAO,CAAiB;IACxB,QAAQ,CAAsB;IAE/C,YACI,MAAoC,EACnB,SAAoB,EACrC,OAAuB,EACN,GAAkB;QAEnC,KAAK,CAAC,MAAM,EAAE,4CAAoB,EAAE,4CAAoB,CAAC,CAAC;QAJzC,cAAS,GAAT,SAAS,CAAW;QAEpB,QAAG,GAAH,GAAG,CAAe;QAGnC,IAAI,CAAC,OAAO,GAAG,IAAI,iCAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,CA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AC;IACjB,CAAC;CACJ,CAAA;AA/DY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAMzB,0CAA4B;QACR,wBAAS;QAC5B,2BAAc;QACD,8BAAa;GAR9B,+BAA+B,CA+D3C","sourcesContent":["/**\n * `ipc-protocol-fingerprint` at the build gate (#1389). Project scoped like `ipc-pairing`: under\n * MODIFIED_PROJECTS it runs when the diff touches a configured IPC file or a project owning one. It\n * recomputes the fingerprint (contract-rooted program only), compares it with the committed manifest, and\n * with the manifest at the branch base (merge-base with main, or NX_BASE), so the protocol can neither\n * decrease nor stay put across a wire change. `pnpm wp-ipc-record-protocol` re-records the manifest.\n */\n\nimport { DiffScope } from '@webpieces/rules-config';\nimport { GitProcessApi } from '@webpieces/tooling-common';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { IpcProtocolFingerprintConfig } from './configs/ipc-configs';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { ProjectCatalog } from './scan-scope';\nimport { IpcProtocolComparison, IpcProtocolSnapshot } from './ipc/ipc-protocol-fingerprint';\nimport { IPC_FINGERPRINT_RULE, IPC_RECORD_COMMAND, IpcProtocolRecorder } from './ipc/ipc-protocol-recorder';\nimport { IpcRuleSupport } from './ipc/ipc-rule-support';\nimport { IpcFinding } from './ipc/ipc-source';\n\n@injectable(bindingScopeValues.Singleton)\nexport class IpcProtocolFingerprintValidator extends CodeValidator<IpcProtocolFingerprintConfig> {\n private readonly support: IpcRuleSupport;\n private readonly recorder: IpcProtocolRecorder;\n\n constructor(\n config: IpcProtocolFingerprintConfig,\n private readonly diffScope: DiffScope,\n catalog: ProjectCatalog,\n private readonly git: GitProcessApi,\n ) {\n super(config, IPC_FINGERPRINT_RULE, IPC_FINGERPRINT_RULE);\n this.support = new IpcRuleSupport(diffScope, catalog);\n this.recorder = new IpcProtocolRecorder(this.support);\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n const mode = this.config.mode;\n if (mode === undefined || mode === 'OFF') return { success: true };\n if (!(await this.support.triggered(workspaceRoot, mode, IPC_FINGERPRINT_RULE, this.triggerGlobs()))) {\n return { success: true };\n }\n const current = await this.recorder.current(workspaceRoot, this.config);\n const committed = this.recorder.committed(workspaceRoot, this.config);\n const base = await this.baseline(workspaceRoot);\n const errors = new IpcProtocolComparison(this.config.versionConstant, IPC_RECORD_COMMAND).compare(\n current,\n committed,\n base,\n );\n if (errors.length === 0) return { success: true };\n const findings = errors.map((error: string) =>\n new IpcFinding(this.config.manifestPath, 1, `protocol ${current.protocol}, fingerprint ${current.fingerprint}`, error));\n throw this.support.failure(\n IPC_FINGERPRINT_RULE,\n `the recorded wire fingerprint must match the source, and a wire change must raise ${this.config.versionConstant}.`,\n findings,\n );\n }\n\n /** The branch base's manifest; without a base, FAIL refuses and VERIFY_COMMITTED skips the increment check. */\n private async baseline(workspaceRoot: string): Promise<IpcProtocolSnapshot | undefined> {\n const range = await this.diffScope.resolveBase(workspaceRoot);\n if (range.base !== undefined) return this.recorder.atBase(workspaceRoot, this.config, range.base, this.git);\n if (this.config.withoutBaseline === 'VERIFY_COMMITTED') {\n console.log(`\\nℹ️ ${IPC_FINGERPRINT_RULE}: no branch base; verifying the committed manifest only.\\n`);\n return undefined;\n }\n throw this.support.failure(IPC_FINGERPRINT_RULE, 'the protocol increment cannot be checked without the branch base.', [\n new IpcFinding(\n this.config.manifestPath,\n 1,\n '',\n 'IPC protocol baseline lookup failed: no merge-base with origin/main or main. Fetch origin main (or set ' +\n 'NX_BASE) and retry; an archive/shallow build checkout configures withoutBaseline: \"VERIFY_COMMITTED\".',\n ),\n ]);\n }\n\n private triggerGlobs(): string[] {\n const globs = [...this.config.contractPaths, ...this.config.normalizedSourceFiles, this.config.versionFile, this.config.manifestPath];\n if (this.config.wireTableFile !== null) globs.push(this.config.wireTableFile);\n return globs;\n }\n}\n"]}
|