@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.
Files changed (55) hide show
  1. package/package.json +8 -7
  2. package/src/code-policy-registry.js +5 -0
  3. package/src/code-policy-registry.js.map +1 -1
  4. package/src/configs/ipc-configs.d.ts +158 -0
  5. package/src/configs/ipc-configs.js +206 -0
  6. package/src/configs/ipc-configs.js.map +1 -0
  7. package/src/index.d.ts +7 -0
  8. package/src/index.js +20 -1
  9. package/src/index.js.map +1 -1
  10. package/src/ipc/ipc-boundary-analyzer.d.ts +92 -0
  11. package/src/ipc/ipc-boundary-analyzer.js +371 -0
  12. package/src/ipc/ipc-boundary-analyzer.js.map +1 -0
  13. package/src/ipc/ipc-contract-inventory.d.ts +83 -0
  14. package/src/ipc/ipc-contract-inventory.js +215 -0
  15. package/src/ipc/ipc-contract-inventory.js.map +1 -0
  16. package/src/ipc/ipc-contract-shape-analyzer.d.ts +54 -0
  17. package/src/ipc/ipc-contract-shape-analyzer.js +186 -0
  18. package/src/ipc/ipc-contract-shape-analyzer.js.map +1 -0
  19. package/src/ipc/ipc-controller-resolver.d.ts +43 -0
  20. package/src/ipc/ipc-controller-resolver.js +187 -0
  21. package/src/ipc/ipc-controller-resolver.js.map +1 -0
  22. package/src/ipc/ipc-pairing-analyzer.d.ts +43 -0
  23. package/src/ipc/ipc-pairing-analyzer.js +247 -0
  24. package/src/ipc/ipc-pairing-analyzer.js.map +1 -0
  25. package/src/ipc/ipc-protocol-fingerprint.d.ts +50 -0
  26. package/src/ipc/ipc-protocol-fingerprint.js +215 -0
  27. package/src/ipc/ipc-protocol-fingerprint.js.map +1 -0
  28. package/src/ipc/ipc-protocol-recorder.d.ts +25 -0
  29. package/src/ipc/ipc-protocol-recorder.js +98 -0
  30. package/src/ipc/ipc-protocol-recorder.js.map +1 -0
  31. package/src/ipc/ipc-rule-support.d.ts +27 -0
  32. package/src/ipc/ipc-rule-support.js +76 -0
  33. package/src/ipc/ipc-rule-support.js.map +1 -0
  34. package/src/ipc/ipc-source.d.ts +96 -0
  35. package/src/ipc/ipc-source.js +239 -0
  36. package/src/ipc/ipc-source.js.map +1 -0
  37. package/src/ipc-record-protocol.d.ts +2 -0
  38. package/src/ipc-record-protocol.js +34 -0
  39. package/src/ipc-record-protocol.js.map +1 -0
  40. package/src/rule-help.js +4 -0
  41. package/src/rule-help.js.map +1 -1
  42. package/src/rule-settings.js +119 -1
  43. package/src/rule-settings.js.map +1 -1
  44. package/src/validate-ipc-boundary.d.ts +20 -0
  45. package/src/validate-ipc-boundary.js +96 -0
  46. package/src/validate-ipc-boundary.js.map +1 -0
  47. package/src/validate-ipc-contract-shape.d.ts +20 -0
  48. package/src/validate-ipc-contract-shape.js +105 -0
  49. package/src/validate-ipc-contract-shape.js.map +1 -0
  50. package/src/validate-ipc-pairing.d.ts +16 -0
  51. package/src/validate-ipc-pairing.js +71 -0
  52. package/src/validate-ipc-pairing.js.map +1 -0
  53. package/src/validate-ipc-protocol-fingerprint.d.ts +23 -0
  54. package/src/validate-ipc-protocol-fingerprint.js +79 -0
  55. package/src/validate-ipc-protocol-fingerprint.js.map +1 -0
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAiE;AAAxD,+GAAA,aAAa,OAAA;AAEtB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,uEAAoE;AAA3D,kIAAA,sBAAsB,OAAA;AAC/B,yEAA0F;AAAjF,oIAAA,uBAAuB,OAAA;AAAE,+HAAA,kBAAkB,OAAA;AACpD,+DAAuD;AAA9C,qHAAA,aAAa,OAAA;AACtB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,iEAAqE;AAA5D,mIAAA,0BAA0B,OAAA;AACnC,uEAA2E;AAAlE,yIAAA,6BAA6B,OAA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A","sourcesContent":["export { CodeValidator, ExecutorResult } from './code-validator';\n\nexport { NoAnyUnknownValidator } from './validate-no-any-unknown';\nexport { NoImplicitAnyValidator } from './validate-no-implicit-any';\nexport { MaxMethodLinesValidator, runModifiedMethods } from './validate-modified-methods';\nexport { runNewMethods } from './validate-new-methods';\nexport { MaxFileLinesValidator } from './validate-modified-files';\nexport { RequireReturnTypeValidator } from './validate-return-types';\nexport { NoInlineTypeLiteralsValidator } from './validate-no-inline-types';\nexport { CatchErrorPatternValidator } from './validate-catch-error-pattern';\nexport { NoUnmanagedExceptionsValidator } from './validate-no-unmanaged-exceptions';\nexport { NoDestructureValidator } from './validate-no-destructure';\nexport { NoDirectApiResolverValidator } from './validate-no-direct-api-resolver';\nexport { NoSymbolDiTokensValidator } from './validate-no-symbol-di-tokens';\nexport { NoClientCreationOutsideServerOrClientValidator } from './validate-no-client-creation-outside-server-or-client';\nexport {\n NoStatePathsInTemplatesValidator,\n StatePathHit,\n StatePathViolation,\n} from './validate-no-state-paths-in-templates';\nexport { ProjectRoleResolver } from './project-role-resolver';\nexport { NoProcessExitOutsideMainValidator } from './validate-no-process-exit-outside-main';\nexport { NoFunctionOutsideClassValidator } from './validate-no-function-outside-class';\nexport {\n InjectAnnotationNotNeededForConcreteClassValidator,\n findRedundantInjectInSource,\n} from './validate-inject-annotation-not-needed-for-concrete-class';\nexport { FrameworkTagValidator } from './validate-framework-tag';\nexport { RoleTagValidator } from './validate-role-tag';\nexport {\n EnsureWeAreSecureValidator,\n SecurityContractViolation,\n auditSecurityContracts,\n findDirectlyChangedProjectRoots,\n} from './validate-ensure-we-are-secure';\nexport { ApiLibFile, ApiLibSite } from './api-lib-source-rule';\nexport { NoInlineImportInApiLibValidator, InlineImportScanner } from './validate-no-inline-import-in-api-lib';\nexport { OneEnumSpellingInApiLibValidator, EnumSpellingScanner } from './validate-one-enum-spelling-in-api-lib';\nexport { NoUtilityTypesInApiLibValidator, UtilityTypeScanner } from './validate-no-utility-types-in-api-lib';\nexport {\n RequiredTypeSuffixValidator,\n ExportedTypeScanner,\n SuffixEntryPicker,\n SuffixRename,\n GoverningGlob,\n} from './validate-required-type-suffix';\nexport { ApiLibEnumIndex } from './api-lib-enum-index';\nexport { ProjectScanTargets, ScannedProject } from './project-scan-targets';\nexport {\n FrameworkTsconfigValidator,\n FrameworkTsconfigAudit,\n RuntimeCompilerOptions,\n TsconfigRuntimeViolation,\n frameworkTsconfigError,\n} from './validate-framework-tsconfig';\nexport {\n FrameworkPackagesValidator,\n FrameworkPackagesAudit,\n FrameworkPackageViolation,\n frameworkPackagesError,\n} from './validate-framework-packages';\nexport { EnumText } from './api-lib-enum-text';\nexport { PrismaValidateDtosValidator } from './validate-dtos';\nexport { PrismaConverterValidator } from './validate-prisma-converters';\nexport { default as validateCode } from './validate-code';\nexport { CodeRulesBootstrap } from './code-rules-bootstrap';\nexport { CodeRulesRunRequest, RuleSelection, RunRequestParser } from './code-rules-run-request';\nexport { ScanScope, GateScanScope, ScanRestriction, ProjectCatalog, ProjectEntry, RecordedSite } from './scan-scope';\nexport { RuleDebugRun, DebugAsk, DebugPlan } from './rule-debug-run';\n// Where code-rules applies the framework-owned path exclusions to every rule it composes (#1253).\nexport { ExclusionScopedPolicy, GlobalExcludePaths, RuleExclusionsFactory } from './rule-dispatch';\n\nexport { ReactNativeCompatibility } from './react-native-compatibility';\n\nexport { METHOD_LIMIT_MODES, RETURN_TYPE_MODES, INLINE_TYPE_MODES, PROJECT_MODES, PRISMA_DTOS_MODES, PRISMA_CONVERTER_MODES, DIRECT_API_RESOLVER_MODES, MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, AngularNoDirectApiInResolverConfig, NoCustomCssConfig, NoSymbolDiTokensConfig, NoProcessExitOutsideMainConfig, NoFunctionOutsideClassConfig, InjectAnnotationNotNeededForConcreteClassConfig, FrameworkTagConfig, RoleTagConfig, EnsureWeAreSecureConfig } from './configs/rule-configs';\nexport type { MethodLimitMode, ReturnTypeMode, InlineTypeMode, ProjectMode, PrismaValidateDtosMode, PrismaConverterMode, DirectApiResolverMode } from './configs/rule-configs';\nexport { CLIENT_CREATION_SEVERITIES, NoClientCreationOutsideServerOrClientConfig } from './configs/no-client-creation-config';\nexport type { ClientCreationSeverity } from './configs/no-client-creation-config';\nexport { DEFAULT_TEMPLATE_DIRS, DEFAULT_BANNED_STATE_PATH_PREFIXES, NoStatePathsInTemplatesConfig } from './configs/no-state-paths-config';\nexport { NoInlineImportInApiLibConfig, OneEnumSpellingInApiLibConfig } from './configs/api-lib-spelling-configs';\nexport { NoUtilityTypesInApiLibConfig } from './configs/no-utility-types-config';\nexport { RequiredTypeSuffixEntry, RequiredTypeSuffixConfig } from './configs/required-type-suffix-config';\nexport { CatchMustPropagateConfig } from './configs/catch-must-propagate-config';\nexport { CatchMustPropagateValidator, LocatedCatchFinding } from './validate-catch-must-propagate';\nexport { PROJECT_SCAN_MODES, FrameworkTsconfigConfig, FrameworkPackagesEntry, FrameworkPackagesConfig } from './configs/tag-truth-configs';\nexport type { ProjectScanMode } from './configs/tag-truth-configs';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAiE;AAAxD,+GAAA,aAAa,OAAA;AAEtB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,uEAAoE;AAA3D,kIAAA,sBAAsB,OAAA;AAC/B,yEAA0F;AAAjF,oIAAA,uBAAuB,OAAA;AAAE,+HAAA,kBAAkB,OAAA;AACpD,+DAAuD;AAA9C,qHAAA,aAAa,OAAA;AACtB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,iEAAqE;AAA5D,mIAAA,0BAA0B,OAAA;AACnC,uEAA2E;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;AAAE,4HAAA,uBAAuB,OAAA;AAErG,qDAA8M;AAArM,6GAAA,cAAc,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,qHAAA,sBAAsB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAAE,2HAAA,4BAA4B,OAAA;AAE9K,iEAA+D;AAAtD,6HAAA,oBAAoB,OAAA;AAC7B,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,yFAAsF;AAA7E,oJAAA,+BAA+B,OAAA;AACxC,2EAAqE;AAA5D,+HAAA,mBAAmB,OAAA","sourcesContent":["export { CodeValidator, ExecutorResult } from './code-validator';\n\nexport { NoAnyUnknownValidator } from './validate-no-any-unknown';\nexport { NoImplicitAnyValidator } from './validate-no-implicit-any';\nexport { MaxMethodLinesValidator, runModifiedMethods } from './validate-modified-methods';\nexport { runNewMethods } from './validate-new-methods';\nexport { MaxFileLinesValidator } from './validate-modified-files';\nexport { RequireReturnTypeValidator } from './validate-return-types';\nexport { NoInlineTypeLiteralsValidator } from './validate-no-inline-types';\nexport { CatchErrorPatternValidator } from './validate-catch-error-pattern';\nexport { NoUnmanagedExceptionsValidator } from './validate-no-unmanaged-exceptions';\nexport { NoDestructureValidator } from './validate-no-destructure';\nexport { NoDirectApiResolverValidator } from './validate-no-direct-api-resolver';\nexport { NoSymbolDiTokensValidator } from './validate-no-symbol-di-tokens';\nexport { NoClientCreationOutsideServerOrClientValidator } from './validate-no-client-creation-outside-server-or-client';\nexport {\n NoStatePathsInTemplatesValidator,\n StatePathHit,\n StatePathViolation,\n} from './validate-no-state-paths-in-templates';\nexport { ProjectRoleResolver } from './project-role-resolver';\nexport { NoProcessExitOutsideMainValidator } from './validate-no-process-exit-outside-main';\nexport { NoFunctionOutsideClassValidator } from './validate-no-function-outside-class';\nexport {\n InjectAnnotationNotNeededForConcreteClassValidator,\n findRedundantInjectInSource,\n} from './validate-inject-annotation-not-needed-for-concrete-class';\nexport { FrameworkTagValidator } from './validate-framework-tag';\nexport { RoleTagValidator } from './validate-role-tag';\nexport {\n EnsureWeAreSecureValidator,\n SecurityContractViolation,\n auditSecurityContracts,\n findDirectlyChangedProjectRoots,\n} from './validate-ensure-we-are-secure';\nexport { ApiLibFile, ApiLibSite } from './api-lib-source-rule';\nexport { NoInlineImportInApiLibValidator, InlineImportScanner } from './validate-no-inline-import-in-api-lib';\nexport { OneEnumSpellingInApiLibValidator, EnumSpellingScanner } from './validate-one-enum-spelling-in-api-lib';\nexport { NoUtilityTypesInApiLibValidator, UtilityTypeScanner } from './validate-no-utility-types-in-api-lib';\nexport {\n RequiredTypeSuffixValidator,\n ExportedTypeScanner,\n SuffixEntryPicker,\n SuffixRename,\n GoverningGlob,\n} from './validate-required-type-suffix';\nexport { ApiLibEnumIndex } from './api-lib-enum-index';\nexport { ProjectScanTargets, ScannedProject } from './project-scan-targets';\nexport {\n FrameworkTsconfigValidator,\n FrameworkTsconfigAudit,\n RuntimeCompilerOptions,\n TsconfigRuntimeViolation,\n frameworkTsconfigError,\n} from './validate-framework-tsconfig';\nexport {\n FrameworkPackagesValidator,\n FrameworkPackagesAudit,\n FrameworkPackageViolation,\n frameworkPackagesError,\n} from './validate-framework-packages';\nexport { EnumText } from './api-lib-enum-text';\nexport { PrismaValidateDtosValidator } from './validate-dtos';\nexport { PrismaConverterValidator } from './validate-prisma-converters';\nexport { default as validateCode } from './validate-code';\nexport { CodeRulesBootstrap } from './code-rules-bootstrap';\nexport { CodeRulesRunRequest, RuleSelection, RunRequestParser } from './code-rules-run-request';\nexport { ScanScope, GateScanScope, ScanRestriction, ProjectCatalog, ProjectEntry, RecordedSite } from './scan-scope';\nexport { RuleDebugRun, DebugAsk, DebugPlan } from './rule-debug-run';\n// Where code-rules applies the framework-owned path exclusions to every rule it composes (#1253).\nexport { ExclusionScopedPolicy, GlobalExcludePaths, RuleExclusionsFactory } from './rule-dispatch';\n\nexport { ReactNativeCompatibility } from './react-native-compatibility';\n\nexport { METHOD_LIMIT_MODES, RETURN_TYPE_MODES, INLINE_TYPE_MODES, PROJECT_MODES, PRISMA_DTOS_MODES, PRISMA_CONVERTER_MODES, DIRECT_API_RESOLVER_MODES, MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, AngularNoDirectApiInResolverConfig, NoCustomCssConfig, NoSymbolDiTokensConfig, NoProcessExitOutsideMainConfig, NoFunctionOutsideClassConfig, InjectAnnotationNotNeededForConcreteClassConfig, FrameworkTagConfig, RoleTagConfig, EnsureWeAreSecureConfig } from './configs/rule-configs';\nexport type { MethodLimitMode, ReturnTypeMode, InlineTypeMode, ProjectMode, PrismaValidateDtosMode, PrismaConverterMode, DirectApiResolverMode } from './configs/rule-configs';\nexport { CLIENT_CREATION_SEVERITIES, NoClientCreationOutsideServerOrClientConfig } from './configs/no-client-creation-config';\nexport type { ClientCreationSeverity } from './configs/no-client-creation-config';\nexport { DEFAULT_TEMPLATE_DIRS, DEFAULT_BANNED_STATE_PATH_PREFIXES, NoStatePathsInTemplatesConfig } from './configs/no-state-paths-config';\nexport { NoInlineImportInApiLibConfig, OneEnumSpellingInApiLibConfig } from './configs/api-lib-spelling-configs';\nexport { NoUtilityTypesInApiLibConfig } from './configs/no-utility-types-config';\nexport { RequiredTypeSuffixEntry, RequiredTypeSuffixConfig } from './configs/required-type-suffix-config';\nexport { CatchMustPropagateConfig } from './configs/catch-must-propagate-config';\nexport { CatchMustPropagateValidator, LocatedCatchFinding } from './validate-catch-must-propagate';\nexport { PROJECT_SCAN_MODES, FrameworkTsconfigConfig, FrameworkPackagesEntry, FrameworkPackagesConfig } from './configs/tag-truth-configs';\nexport type { ProjectScanMode } from './configs/tag-truth-configs';\nexport { IPC_FILE_MODES, IPC_PROJECT_MODES, IPC_WITHOUT_BASELINE, IpcBoundaryConfig, IpcContractShapeConfig, IpcDirectionEntry, IpcPairingConfig, IpcProtocolFingerprintConfig } from './configs/ipc-configs';\nexport type { IpcFileMode, IpcProjectMode, IpcWithoutBaseline } from './configs/ipc-configs';\nexport { IpcBoundaryValidator } from './validate-ipc-boundary';\nexport { IpcContractShapeValidator } from './validate-ipc-contract-shape';\nexport { IpcPairingValidator } from './validate-ipc-pairing';\nexport { IpcProtocolFingerprintValidator } from './validate-ipc-protocol-fingerprint';\nexport { IpcProtocolSnapshot } from './ipc/ipc-protocol-fingerprint';\n"]}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * `ipc-boundary` judgement (#1389): one file, its syntax tree only. Ports the boundary half of the
3
+ * consumer script's `inspectProgram` — the part that answered "nobody else may":
4
+ *
5
+ * - `@webpieces/ipc-bridge` is imported, and its factories are built and called, only in composition files;
6
+ * - raw `IpcConnection` / `IpcRequest` / `IpcSuccess` / `IpcFailure` / `IpcTransport` are imported outside
7
+ * transport/composition files by nobody, constructed and driven (`request`, `setHandler`, `subscribe`,
8
+ * `send`) only in transport files;
9
+ * - raw WebView delivery (`injectJavaScript`, a WebView `postMessage`, destructuring either off a WebView)
10
+ * happens only in transport (or bootstrap) files, and a transport module's raw functions are imported
11
+ * only where they may be called;
12
+ * - retired modules, retired identifiers, handwritten wire-client class names and test-only scaffolding
13
+ * imports are refused everywhere; transport/bootstrap files author no legacy wire constant or command.
14
+ *
15
+ * The script resolved every alias with the checker. Here an alias is followed INSIDE the file — an import
16
+ * rename, `const F = IpcClientFactory`, `const alias = webView`, a declaration typed with an imported
17
+ * framework class — which is what a feature file would have to write to reach any of these, since every
18
+ * route in starts with an import this rule sees.
19
+ */
20
+ import { IpcBoundaryConfig } from '../configs/ipc-configs';
21
+ import { IpcFinding, IpcModuleResolver, IpcSourceFile } from './ipc-source';
22
+ /** The framework's own vocabulary — webpieces' ipc-bridge surface, not consumer configuration. */
23
+ export declare class IpcFrameworkNames {
24
+ static readonly BRIDGE_MODULE = "@webpieces/ipc-bridge";
25
+ static readonly CORE_IPC_MODULE = "@webpieces/core-util/ipc";
26
+ static readonly WEBVIEW_MODULE = "react-native-webview";
27
+ static readonly FACTORY_CLASSES: readonly string[];
28
+ static readonly RAW_TYPES: readonly string[];
29
+ static readonly RAW_CONSTRUCTIBLE: readonly string[];
30
+ static readonly FACTORY_METHODS: readonly string[];
31
+ static readonly CONNECTION_METHODS: readonly string[];
32
+ static readonly TRANSPORT_RAW_EXPORTS: readonly string[];
33
+ static readonly WEBVIEW_RAW_MEMBERS: readonly string[];
34
+ static readonly WEBVIEW_RECEIVER: RegExp;
35
+ }
36
+ /** Why a site is refused. One spelling per reason, so a report groups cleanly. */
37
+ export declare class IpcBoundaryReasons {
38
+ static readonly COMPOSITION: string;
39
+ static readonly TEST_SUPPORT = "Production code cannot import test-only IPC scaffolding.";
40
+ static readonly RETIRED_MODULE = "This module is retired from the IPC boundary. Protocol discovery uses only the bounded bootstrap envelope.";
41
+ static readonly RETIRED_IDENTIFIER = "This raw IPC helper is retired; inject the generated shared API client.";
42
+ static readonly HANDWRITTEN_CLIENT = "Handwritten directional wire clients are retired; inject the generated shared API client.";
43
+ static readonly LEGACY_CONSTANT = "Only protocol bootstrap may use the raw discovery operation; feature wire constants are forbidden in IPC infrastructure.";
44
+ static readonly LEGACY_COMMAND = "Do not author legacy feature wire commands in IPC infrastructure.";
45
+ }
46
+ /** Which privileged role the judged file plays. Data-only. */
47
+ export declare class IpcFileRole {
48
+ readonly transport: boolean;
49
+ readonly composition: boolean;
50
+ readonly bootstrap: boolean;
51
+ constructor(transport: boolean, composition: boolean, bootstrap: boolean);
52
+ }
53
+ /** The boundary config, compiled once per run. */
54
+ export declare class IpcBoundaryPolicy {
55
+ readonly config: IpcBoundaryConfig;
56
+ /** The exported constants of `legacyWireFile` (empty when it is null). */
57
+ readonly legacyNames: ReadonlySet<string>;
58
+ readonly classPatterns: readonly RegExp[];
59
+ constructor(config: IpcBoundaryConfig,
60
+ /** The exported constants of `legacyWireFile` (empty when it is null). */
61
+ legacyNames: ReadonlySet<string>);
62
+ roleOf(relFile: string): IpcFileRole;
63
+ isTransportFile(relFile: string): boolean;
64
+ }
65
+ export declare class IpcBoundaryAnalyzer {
66
+ private readonly policy;
67
+ private readonly resolver;
68
+ constructor(policy: IpcBoundaryPolicy, resolver: IpcModuleResolver);
69
+ analyze(file: IpcSourceFile): IpcFinding[];
70
+ private factsOf;
71
+ private learnImport;
72
+ private learnDeclaration;
73
+ private originOfType;
74
+ private originOfClassName;
75
+ private originOfValue;
76
+ /** What `expr` holds when it is a tracked name, `this.<tracked>`, or a namespace import. */
77
+ private originOfReceiver;
78
+ /** The framework/transport class a `new` builds, through import renames, aliases and namespaces. */
79
+ private constructedName;
80
+ private judgeBinding;
81
+ private judgeNode;
82
+ private judgeModuleDeclaration;
83
+ private endsWithModule;
84
+ private judgeDynamicLoad;
85
+ private judgeClassName;
86
+ private judgeConstruction;
87
+ private judgeMember;
88
+ private memberName;
89
+ private judgeDestructure;
90
+ private judgeLegacyCommand;
91
+ private unwrap;
92
+ }
@@ -0,0 +1,371 @@
1
+ "use strict";
2
+ /**
3
+ * `ipc-boundary` judgement (#1389): one file, its syntax tree only. Ports the boundary half of the
4
+ * consumer script's `inspectProgram` — the part that answered "nobody else may":
5
+ *
6
+ * - `@webpieces/ipc-bridge` is imported, and its factories are built and called, only in composition files;
7
+ * - raw `IpcConnection` / `IpcRequest` / `IpcSuccess` / `IpcFailure` / `IpcTransport` are imported outside
8
+ * transport/composition files by nobody, constructed and driven (`request`, `setHandler`, `subscribe`,
9
+ * `send`) only in transport files;
10
+ * - raw WebView delivery (`injectJavaScript`, a WebView `postMessage`, destructuring either off a WebView)
11
+ * happens only in transport (or bootstrap) files, and a transport module's raw functions are imported
12
+ * only where they may be called;
13
+ * - retired modules, retired identifiers, handwritten wire-client class names and test-only scaffolding
14
+ * imports are refused everywhere; transport/bootstrap files author no legacy wire constant or command.
15
+ *
16
+ * The script resolved every alias with the checker. Here an alias is followed INSIDE the file — an import
17
+ * rename, `const F = IpcClientFactory`, `const alias = webView`, a declaration typed with an imported
18
+ * framework class — which is what a feature file would have to write to reach any of these, since every
19
+ * route in starts with an import this rule sees.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.IpcBoundaryAnalyzer = exports.IpcBoundaryPolicy = exports.IpcFileRole = exports.IpcBoundaryReasons = exports.IpcFrameworkNames = void 0;
23
+ const tslib_1 = require("tslib");
24
+ const ts = tslib_1.__importStar(require("typescript"));
25
+ const rules_config_1 = require("@webpieces/rules-config");
26
+ /** The framework's own vocabulary — webpieces' ipc-bridge surface, not consumer configuration. */
27
+ class IpcFrameworkNames {
28
+ static BRIDGE_MODULE = '@webpieces/ipc-bridge';
29
+ static CORE_IPC_MODULE = '@webpieces/core-util/ipc';
30
+ static WEBVIEW_MODULE = 'react-native-webview';
31
+ static FACTORY_CLASSES = ['IpcClientFactory', 'IpcServerFactory'];
32
+ static RAW_TYPES = ['IpcConnection', 'IpcRequest', 'IpcSuccess', 'IpcFailure', 'IpcTransport'];
33
+ static RAW_CONSTRUCTIBLE = ['IpcConnection', 'IpcRequest', 'IpcSuccess', 'IpcFailure'];
34
+ static FACTORY_METHODS = ['createClient', 'create', 'createScoped', 'withContext'];
35
+ static CONNECTION_METHODS = ['request', 'setHandler', 'subscribe', 'send'];
36
+ static TRANSPORT_RAW_EXPORTS = ['request', 'send', 'notify', 'sendLegacy'];
37
+ static WEBVIEW_RAW_MEMBERS = ['postMessage', 'injectJavaScript'];
38
+ static WEBVIEW_RECEIVER = /ReactNativeWebView|web[Vv]iew/;
39
+ }
40
+ exports.IpcFrameworkNames = IpcFrameworkNames;
41
+ const N = IpcFrameworkNames;
42
+ /** Why a site is refused. One spelling per reason, so a report groups cleanly. */
43
+ class IpcBoundaryReasons {
44
+ static COMPOSITION = 'Use an injected shared directional API. Only registered composition modules may create framework IPC ' +
45
+ 'clients/receivers; only registered transport modules may send raw messages.';
46
+ static TEST_SUPPORT = 'Production code cannot import test-only IPC scaffolding.';
47
+ static RETIRED_MODULE = 'This module is retired from the IPC boundary. Protocol discovery uses only the bounded bootstrap envelope.';
48
+ static RETIRED_IDENTIFIER = 'This raw IPC helper is retired; inject the generated shared API client.';
49
+ static HANDWRITTEN_CLIENT = 'Handwritten directional wire clients are retired; inject the generated shared API client.';
50
+ static LEGACY_CONSTANT = 'Only protocol bootstrap may use the raw discovery operation; feature wire constants are forbidden in IPC infrastructure.';
51
+ static LEGACY_COMMAND = 'Do not author legacy feature wire commands in IPC infrastructure.';
52
+ }
53
+ exports.IpcBoundaryReasons = IpcBoundaryReasons;
54
+ const R = IpcBoundaryReasons;
55
+ /** What a local name is known to hold. */
56
+ var Origin;
57
+ (function (Origin) {
58
+ Origin["FACTORY"] = "factory";
59
+ Origin["CONNECTION"] = "connection";
60
+ Origin["TRANSPORT"] = "transport";
61
+ Origin["WEBVIEW"] = "webview";
62
+ })(Origin || (Origin = {}));
63
+ /** Which privileged role the judged file plays. Data-only. */
64
+ class IpcFileRole {
65
+ transport;
66
+ composition;
67
+ bootstrap;
68
+ constructor(transport, composition, bootstrap) {
69
+ this.transport = transport;
70
+ this.composition = composition;
71
+ this.bootstrap = bootstrap;
72
+ }
73
+ }
74
+ exports.IpcFileRole = IpcFileRole;
75
+ /** The boundary config, compiled once per run. */
76
+ class IpcBoundaryPolicy {
77
+ config;
78
+ legacyNames;
79
+ classPatterns;
80
+ constructor(config,
81
+ /** The exported constants of `legacyWireFile` (empty when it is null). */
82
+ legacyNames) {
83
+ this.config = config;
84
+ this.legacyNames = legacyNames;
85
+ this.classPatterns = config.forbiddenClassNamePatterns.map((pattern) => new RegExp(pattern));
86
+ }
87
+ roleOf(relFile) {
88
+ const transport = (0, rules_config_1.matchesAnyGlob)(relFile, this.config.transportFiles);
89
+ const composition = transport || (0, rules_config_1.matchesAnyGlob)(relFile, this.config.compositionFiles);
90
+ return new IpcFileRole(transport, composition, (0, rules_config_1.matchesAnyGlob)(relFile, this.config.bootstrapFiles));
91
+ }
92
+ isTransportFile(relFile) {
93
+ return (0, rules_config_1.matchesAnyGlob)(relFile, this.config.transportFiles);
94
+ }
95
+ }
96
+ exports.IpcBoundaryPolicy = IpcBoundaryPolicy;
97
+ /** Per-file knowledge: which local names are framework classes, and what each tracked name holds. */
98
+ class FileFacts {
99
+ classAliases = new Map();
100
+ namespaces = new Map();
101
+ transportImports = new Set();
102
+ webviewTypes = new Set();
103
+ origins = new Map();
104
+ }
105
+ class IpcBoundaryAnalyzer {
106
+ policy;
107
+ resolver;
108
+ constructor(policy, resolver) {
109
+ this.policy = policy;
110
+ this.resolver = resolver;
111
+ }
112
+ analyze(file) {
113
+ const role = this.policy.roleOf(file.relFile);
114
+ const facts = this.factsOf(file);
115
+ const findings = [];
116
+ for (const binding of file.imports())
117
+ findings.push(...this.judgeBinding(file, binding, role));
118
+ const visit = (node) => {
119
+ findings.push(...this.judgeNode(file, node, role, facts));
120
+ ts.forEachChild(node, visit);
121
+ };
122
+ visit(file.source);
123
+ const seen = new Set();
124
+ return findings.filter((finding) => {
125
+ const key = `${finding.line}\u0000${finding.message}\u0000${finding.snippet}`;
126
+ if (seen.has(key))
127
+ return false;
128
+ seen.add(key);
129
+ return true;
130
+ });
131
+ }
132
+ factsOf(file) {
133
+ const facts = new FileFacts();
134
+ for (const binding of file.imports())
135
+ this.learnImport(file, binding, facts);
136
+ // Two passes so an alias of an alias (`const a = webView; const b = a;`) is followed.
137
+ for (let pass = 0; pass < 2; pass++) {
138
+ const visit = (node) => {
139
+ this.learnDeclaration(node, facts);
140
+ ts.forEachChild(node, visit);
141
+ };
142
+ visit(file.source);
143
+ }
144
+ return facts;
145
+ }
146
+ learnImport(file, binding, facts) {
147
+ const framework = binding.moduleSpecifier === N.BRIDGE_MODULE || binding.moduleSpecifier === N.CORE_IPC_MODULE;
148
+ if (framework && binding.imported === '*')
149
+ facts.namespaces.set(binding.local, binding.moduleSpecifier);
150
+ if (framework && (N.FACTORY_CLASSES.includes(binding.imported) || N.RAW_TYPES.includes(binding.imported))) {
151
+ facts.classAliases.set(binding.local, binding.imported);
152
+ }
153
+ if (binding.moduleSpecifier === N.WEBVIEW_MODULE)
154
+ facts.webviewTypes.add(binding.local);
155
+ const target = this.resolver.resolve(file.relFile, binding.moduleSpecifier);
156
+ if (target === undefined || !this.policy.isTransportFile(target))
157
+ return;
158
+ if (binding.imported === '*')
159
+ facts.origins.set(binding.local, Origin.TRANSPORT);
160
+ else
161
+ facts.transportImports.add(binding.local);
162
+ }
163
+ learnDeclaration(node, facts) {
164
+ const declared = ts.isVariableDeclaration(node) || ts.isParameter(node) || ts.isPropertyDeclaration(node) ? node : undefined;
165
+ if (declared === undefined || !ts.isIdentifier(declared.name))
166
+ return;
167
+ const name = declared.name.text;
168
+ const initializer = declared.initializer === undefined ? undefined : this.unwrap(declared.initializer);
169
+ if (initializer !== undefined && ts.isIdentifier(initializer)) {
170
+ const aliased = facts.classAliases.get(initializer.text);
171
+ if (aliased !== undefined)
172
+ facts.classAliases.set(name, aliased);
173
+ }
174
+ const origin = this.originOfType(declared.type, facts) ?? this.originOfValue(initializer, facts);
175
+ if (origin !== undefined)
176
+ facts.origins.set(name, origin);
177
+ }
178
+ originOfType(type, facts) {
179
+ if (type === undefined || !ts.isTypeReferenceNode(type))
180
+ return undefined;
181
+ const name = ts.isIdentifier(type.typeName) ? type.typeName.text : type.typeName.right.text;
182
+ return this.originOfClassName(name, facts);
183
+ }
184
+ originOfClassName(name, facts) {
185
+ const known = N.FACTORY_CLASSES.includes(name) || N.RAW_TYPES.includes(name);
186
+ const framework = facts.classAliases.get(name) ?? (known ? name : undefined);
187
+ if (framework !== undefined && N.FACTORY_CLASSES.includes(framework))
188
+ return Origin.FACTORY;
189
+ if (framework === 'IpcConnection')
190
+ return Origin.CONNECTION;
191
+ if (facts.transportImports.has(name))
192
+ return Origin.TRANSPORT;
193
+ if (facts.webviewTypes.has(name))
194
+ return Origin.WEBVIEW;
195
+ return undefined;
196
+ }
197
+ originOfValue(value, facts) {
198
+ if (value === undefined)
199
+ return undefined;
200
+ if (ts.isNewExpression(value)) {
201
+ const constructed = this.constructedName(value, facts);
202
+ return constructed === undefined ? undefined : this.originOfClassName(constructed, facts);
203
+ }
204
+ const tracked = this.originOfReceiver(value, facts);
205
+ if (tracked !== undefined)
206
+ return tracked;
207
+ return N.WEBVIEW_RECEIVER.test(value.getText()) ? Origin.WEBVIEW : undefined;
208
+ }
209
+ /** What `expr` holds when it is a tracked name, `this.<tracked>`, or a namespace import. */
210
+ originOfReceiver(expr, facts) {
211
+ const node = this.unwrap(expr);
212
+ if (ts.isIdentifier(node))
213
+ return facts.origins.get(node.text);
214
+ if (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.ThisKeyword) {
215
+ return facts.origins.get(node.name.text);
216
+ }
217
+ return undefined;
218
+ }
219
+ /** The framework/transport class a `new` builds, through import renames, aliases and namespaces. */
220
+ constructedName(node, facts) {
221
+ const callee = this.unwrap(node.expression);
222
+ if (ts.isIdentifier(callee))
223
+ return facts.classAliases.get(callee.text) ?? callee.text;
224
+ if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression)) {
225
+ if (facts.namespaces.has(callee.expression.text))
226
+ return callee.name.text;
227
+ }
228
+ return undefined;
229
+ }
230
+ judgeBinding(file, binding, role) {
231
+ const out = [];
232
+ const isCoreRaw = binding.moduleSpecifier === N.CORE_IPC_MODULE && N.RAW_TYPES.includes(binding.imported);
233
+ if (isCoreRaw && !role.transport && !role.composition)
234
+ out.push(file.finding(binding.node, R.COMPOSITION));
235
+ const target = this.resolver.resolve(file.relFile, binding.moduleSpecifier);
236
+ if (target !== undefined && this.policy.isTransportFile(target) && !role.bootstrap) {
237
+ const raw = N.TRANSPORT_RAW_EXPORTS.includes(binding.imported) && !role.transport;
238
+ const client = binding.imported === 'createClient' && !role.composition;
239
+ if (raw || client)
240
+ out.push(file.finding(binding.node, R.COMPOSITION));
241
+ }
242
+ const legacy = this.policy.legacyNames.has(binding.imported) && !binding.typeOnly;
243
+ const allowed = role.bootstrap && this.policy.config.bootstrapAllowedLegacyNames.includes(binding.imported);
244
+ if (legacy && (role.transport || role.bootstrap) && !allowed)
245
+ out.push(file.finding(binding.node, R.LEGACY_CONSTANT));
246
+ return out;
247
+ }
248
+ judgeNode(file, node, role, facts) {
249
+ if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node))
250
+ return this.judgeModuleDeclaration(file, node, role);
251
+ if (ts.isCallExpression(node))
252
+ return this.judgeDynamicLoad(file, node, role);
253
+ if (ts.isClassDeclaration(node))
254
+ return this.judgeClassName(file, node);
255
+ if (ts.isNewExpression(node))
256
+ return this.judgeConstruction(file, node, role, facts);
257
+ if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
258
+ return this.judgeMember(file, node, role, facts);
259
+ }
260
+ if (ts.isBindingElement(node))
261
+ return this.judgeDestructure(file, node, role, facts);
262
+ if (ts.isIdentifier(node) && this.policy.config.retiredIdentifiers.includes(node.text)) {
263
+ return [file.finding(node, R.RETIRED_IDENTIFIER)];
264
+ }
265
+ if ((role.transport || role.bootstrap) && ts.isStringLiteral(node))
266
+ return this.judgeLegacyCommand(file, node);
267
+ return [];
268
+ }
269
+ judgeModuleDeclaration(file, node, role) {
270
+ const specifierNode = node.moduleSpecifier;
271
+ if (specifierNode === undefined || !ts.isStringLiteral(specifierNode))
272
+ return [];
273
+ const specifier = specifierNode.text;
274
+ const out = [];
275
+ if (this.policy.config.testOnlyModuleSuffixes.some((suffix) => this.endsWithModule(specifier, suffix))) {
276
+ out.push(file.finding(node, R.TEST_SUPPORT));
277
+ }
278
+ if (this.policy.config.retiredModules.includes(specifier))
279
+ out.push(file.finding(node, R.RETIRED_MODULE));
280
+ if (specifier === N.BRIDGE_MODULE && !role.composition)
281
+ out.push(file.finding(node, R.COMPOSITION));
282
+ return out;
283
+ }
284
+ endsWithModule(specifier, suffix) {
285
+ return specifier.endsWith(suffix) || specifier.endsWith(`${suffix}.js`) || specifier.endsWith(`${suffix}.ts`);
286
+ }
287
+ judgeDynamicLoad(file, node, role) {
288
+ const loader = node.expression.kind === ts.SyntaxKind.ImportKeyword ||
289
+ (ts.isIdentifier(node.expression) && node.expression.text === 'require');
290
+ const first = node.arguments[0];
291
+ if (!loader || first === undefined || !ts.isStringLiteralLike(first))
292
+ return [];
293
+ if (this.policy.config.retiredModules.includes(first.text))
294
+ return [file.finding(node, R.RETIRED_MODULE)];
295
+ if (first.text === N.BRIDGE_MODULE && !role.composition)
296
+ return [file.finding(node, R.COMPOSITION)];
297
+ return [];
298
+ }
299
+ judgeClassName(file, node) {
300
+ const name = node.name?.text;
301
+ if (name === undefined)
302
+ return [];
303
+ const refused = this.policy.classPatterns.some((pattern) => pattern.test(name));
304
+ return refused ? [file.finding(node.name ?? node, R.HANDWRITTEN_CLIENT)] : [];
305
+ }
306
+ judgeConstruction(file, node, role, facts) {
307
+ const name = this.constructedName(node, facts);
308
+ if (name === undefined)
309
+ return [];
310
+ if (N.FACTORY_CLASSES.includes(name) && !role.composition)
311
+ return [file.finding(node, R.COMPOSITION)];
312
+ if (N.RAW_CONSTRUCTIBLE.includes(name) && !role.transport)
313
+ return [file.finding(node, R.COMPOSITION)];
314
+ return [];
315
+ }
316
+ judgeMember(file, node, role, facts) {
317
+ const member = this.memberName(node);
318
+ if (member === undefined)
319
+ return [];
320
+ const origin = this.originOfReceiver(node.expression, facts);
321
+ const webview = origin === Origin.WEBVIEW || N.WEBVIEW_RECEIVER.test(node.expression.getText());
322
+ const rawDelivery = member === 'injectJavaScript' || (member === 'postMessage' && webview);
323
+ if (rawDelivery && !role.transport && !role.bootstrap)
324
+ return [file.finding(node, R.COMPOSITION)];
325
+ if (origin === Origin.FACTORY && N.FACTORY_METHODS.includes(member) && !role.composition) {
326
+ return [file.finding(node, R.COMPOSITION)];
327
+ }
328
+ if (origin === Origin.CONNECTION && N.CONNECTION_METHODS.includes(member) && !role.transport) {
329
+ return [file.finding(node, R.COMPOSITION)];
330
+ }
331
+ if (origin === Origin.TRANSPORT && !role.bootstrap) {
332
+ const raw = N.TRANSPORT_RAW_EXPORTS.includes(member) && !role.transport;
333
+ const client = member === 'createClient' && !role.composition;
334
+ if (raw || client)
335
+ return [file.finding(node, R.COMPOSITION)];
336
+ }
337
+ return [];
338
+ }
339
+ memberName(node) {
340
+ if (ts.isPropertyAccessExpression(node))
341
+ return node.name.text;
342
+ return ts.isStringLiteralLike(node.argumentExpression) ? node.argumentExpression.text : undefined;
343
+ }
344
+ judgeDestructure(file, node, role, facts) {
345
+ if (role.transport)
346
+ return [];
347
+ const key = node.propertyName ?? node.name;
348
+ const name = ts.isIdentifier(key) || ts.isStringLiteral(key) ? key.text : undefined;
349
+ if (name === undefined || !N.WEBVIEW_RAW_MEMBERS.includes(name))
350
+ return [];
351
+ const declaration = node.parent.parent;
352
+ if (!ts.isVariableDeclaration(declaration) || declaration.initializer === undefined)
353
+ return [];
354
+ const source = declaration.initializer;
355
+ const webview = this.originOfReceiver(source, facts) === Origin.WEBVIEW || N.WEBVIEW_RECEIVER.test(source.getText());
356
+ return webview ? [file.finding(node, R.COMPOSITION)] : [];
357
+ }
358
+ judgeLegacyCommand(file, node) {
359
+ const legacy = this.policy.config.legacyWireCommandPrefixes.some((prefix) => node.text.startsWith(prefix));
360
+ return legacy ? [file.finding(node, R.LEGACY_COMMAND)] : [];
361
+ }
362
+ unwrap(expr) {
363
+ let node = expr;
364
+ while (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isNonNullExpression(node) || ts.isSatisfiesExpression(node)) {
365
+ node = node.expression;
366
+ }
367
+ return node;
368
+ }
369
+ }
370
+ exports.IpcBoundaryAnalyzer = IpcBoundaryAnalyzer;
371
+ //# sourceMappingURL=ipc-boundary-analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ipc-boundary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C,IAAI,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;YACrI,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAtPD,kDAsPC","sourcesContent":["/**\n * `ipc-boundary` judgement (#1389): one file, its syntax tree only. Ports the boundary half of the\n * consumer script's `inspectProgram` — the part that answered \"nobody else may\":\n *\n * - `@webpieces/ipc-bridge` is imported, and its factories are built and called, only in composition files;\n * - raw `IpcConnection` / `IpcRequest` / `IpcSuccess` / `IpcFailure` / `IpcTransport` are imported outside\n * transport/composition files by nobody, constructed and driven (`request`, `setHandler`, `subscribe`,\n * `send`) only in transport files;\n * - raw WebView delivery (`injectJavaScript`, a WebView `postMessage`, destructuring either off a WebView)\n * happens only in transport (or bootstrap) files, and a transport module's raw functions are imported\n * only where they may be called;\n * - retired modules, retired identifiers, handwritten wire-client class names and test-only scaffolding\n * imports are refused everywhere; transport/bootstrap files author no legacy wire constant or command.\n *\n * The script resolved every alias with the checker. Here an alias is followed INSIDE the file — an import\n * rename, `const F = IpcClientFactory`, `const alias = webView`, a declaration typed with an imported\n * framework class — which is what a feature file would have to write to reach any of these, since every\n * route in starts with an import this rule sees.\n */\n\nimport * as ts from 'typescript';\nimport { matchesAnyGlob } from '@webpieces/rules-config';\nimport { IpcBoundaryConfig } from '../configs/ipc-configs';\nimport { IpcFinding, IpcImportBinding, IpcModuleResolver, IpcSourceFile } from './ipc-source';\n\n/** The framework's own vocabulary — webpieces' ipc-bridge surface, not consumer configuration. */\nexport class IpcFrameworkNames {\n static readonly BRIDGE_MODULE = '@webpieces/ipc-bridge';\n static readonly CORE_IPC_MODULE = '@webpieces/core-util/ipc';\n static readonly WEBVIEW_MODULE = 'react-native-webview';\n static readonly FACTORY_CLASSES: readonly string[] = ['IpcClientFactory', 'IpcServerFactory'];\n static readonly RAW_TYPES: readonly string[] = ['IpcConnection', 'IpcRequest', 'IpcSuccess', 'IpcFailure', 'IpcTransport'];\n static readonly RAW_CONSTRUCTIBLE: readonly string[] = ['IpcConnection', 'IpcRequest', 'IpcSuccess', 'IpcFailure'];\n static readonly FACTORY_METHODS: readonly string[] = ['createClient', 'create', 'createScoped', 'withContext'];\n static readonly CONNECTION_METHODS: readonly string[] = ['request', 'setHandler', 'subscribe', 'send'];\n static readonly TRANSPORT_RAW_EXPORTS: readonly string[] = ['request', 'send', 'notify', 'sendLegacy'];\n static readonly WEBVIEW_RAW_MEMBERS: readonly string[] = ['postMessage', 'injectJavaScript'];\n static readonly WEBVIEW_RECEIVER = /ReactNativeWebView|web[Vv]iew/;\n}\n\nconst N = IpcFrameworkNames;\n\n/** Why a site is refused. One spelling per reason, so a report groups cleanly. */\nexport class IpcBoundaryReasons {\n static readonly COMPOSITION =\n 'Use an injected shared directional API. Only registered composition modules may create framework IPC ' +\n 'clients/receivers; only registered transport modules may send raw messages.';\n static readonly TEST_SUPPORT = 'Production code cannot import test-only IPC scaffolding.';\n static readonly RETIRED_MODULE =\n 'This module is retired from the IPC boundary. Protocol discovery uses only the bounded bootstrap envelope.';\n static readonly RETIRED_IDENTIFIER = 'This raw IPC helper is retired; inject the generated shared API client.';\n static readonly HANDWRITTEN_CLIENT =\n 'Handwritten directional wire clients are retired; inject the generated shared API client.';\n static readonly LEGACY_CONSTANT =\n 'Only protocol bootstrap may use the raw discovery operation; feature wire constants are forbidden in IPC infrastructure.';\n static readonly LEGACY_COMMAND = 'Do not author legacy feature wire commands in IPC infrastructure.';\n}\n\nconst R = IpcBoundaryReasons;\n\n/** What a local name is known to hold. */\nenum Origin {\n FACTORY = 'factory',\n CONNECTION = 'connection',\n TRANSPORT = 'transport',\n WEBVIEW = 'webview',\n}\n\n/** Which privileged role the judged file plays. Data-only. */\nexport class IpcFileRole {\n constructor(\n readonly transport: boolean,\n readonly composition: boolean,\n readonly bootstrap: boolean,\n ) {}\n}\n\n/** The boundary config, compiled once per run. */\nexport class IpcBoundaryPolicy {\n readonly classPatterns: readonly RegExp[];\n\n constructor(\n readonly config: IpcBoundaryConfig,\n /** The exported constants of `legacyWireFile` (empty when it is null). */\n readonly legacyNames: ReadonlySet<string>,\n ) {\n this.classPatterns = config.forbiddenClassNamePatterns.map((pattern: string) => new RegExp(pattern));\n }\n\n roleOf(relFile: string): IpcFileRole {\n const transport = matchesAnyGlob(relFile, this.config.transportFiles);\n const composition = transport || matchesAnyGlob(relFile, this.config.compositionFiles);\n return new IpcFileRole(transport, composition, matchesAnyGlob(relFile, this.config.bootstrapFiles));\n }\n\n isTransportFile(relFile: string): boolean {\n return matchesAnyGlob(relFile, this.config.transportFiles);\n }\n}\n\n/** Per-file knowledge: which local names are framework classes, and what each tracked name holds. */\nclass FileFacts {\n readonly classAliases = new Map<string, string>();\n readonly namespaces = new Map<string, string>();\n readonly transportImports = new Set<string>();\n readonly webviewTypes = new Set<string>();\n readonly origins = new Map<string, Origin>();\n}\n\nexport class IpcBoundaryAnalyzer {\n constructor(\n private readonly policy: IpcBoundaryPolicy,\n private readonly resolver: IpcModuleResolver,\n ) {}\n\n analyze(file: IpcSourceFile): IpcFinding[] {\n const role = this.policy.roleOf(file.relFile);\n const facts = this.factsOf(file);\n const findings: IpcFinding[] = [];\n for (const binding of file.imports()) findings.push(...this.judgeBinding(file, binding, role));\n const visit = (node: ts.Node): void => {\n findings.push(...this.judgeNode(file, node, role, facts));\n ts.forEachChild(node, visit);\n };\n visit(file.source);\n const seen = new Set<string>();\n return findings.filter((finding: IpcFinding) => {\n const key = `${finding.line}\\u0000${finding.message}\\u0000${finding.snippet}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }\n\n private factsOf(file: IpcSourceFile): FileFacts {\n const facts = new FileFacts();\n for (const binding of file.imports()) this.learnImport(file, binding, facts);\n // Two passes so an alias of an alias (`const a = webView; const b = a;`) is followed.\n for (let pass = 0; pass < 2; pass++) {\n const visit = (node: ts.Node): void => {\n this.learnDeclaration(node, facts);\n ts.forEachChild(node, visit);\n };\n visit(file.source);\n }\n return facts;\n }\n\n private learnImport(file: IpcSourceFile, binding: IpcImportBinding, facts: FileFacts): void {\n const framework = binding.moduleSpecifier === N.BRIDGE_MODULE || binding.moduleSpecifier === N.CORE_IPC_MODULE;\n if (framework && binding.imported === '*') facts.namespaces.set(binding.local, binding.moduleSpecifier);\n if (framework && (N.FACTORY_CLASSES.includes(binding.imported) || N.RAW_TYPES.includes(binding.imported))) {\n facts.classAliases.set(binding.local, binding.imported);\n }\n if (binding.moduleSpecifier === N.WEBVIEW_MODULE) facts.webviewTypes.add(binding.local);\n const target = this.resolver.resolve(file.relFile, binding.moduleSpecifier);\n if (target === undefined || !this.policy.isTransportFile(target)) return;\n if (binding.imported === '*') facts.origins.set(binding.local, Origin.TRANSPORT);\n else facts.transportImports.add(binding.local);\n }\n\n private learnDeclaration(node: ts.Node, facts: FileFacts): void {\n const declared =\n ts.isVariableDeclaration(node) || ts.isParameter(node) || ts.isPropertyDeclaration(node) ? node : undefined;\n if (declared === undefined || !ts.isIdentifier(declared.name)) return;\n const name = declared.name.text;\n const initializer = declared.initializer === undefined ? undefined : this.unwrap(declared.initializer);\n if (initializer !== undefined && ts.isIdentifier(initializer)) {\n const aliased = facts.classAliases.get(initializer.text);\n if (aliased !== undefined) facts.classAliases.set(name, aliased);\n }\n const origin = this.originOfType(declared.type, facts) ?? this.originOfValue(initializer, facts);\n if (origin !== undefined) facts.origins.set(name, origin);\n }\n\n private originOfType(type: ts.TypeNode | undefined, facts: FileFacts): Origin | undefined {\n if (type === undefined || !ts.isTypeReferenceNode(type)) return undefined;\n const name = ts.isIdentifier(type.typeName) ? type.typeName.text : type.typeName.right.text;\n return this.originOfClassName(name, facts);\n }\n\n private originOfClassName(name: string, facts: FileFacts): Origin | undefined {\n const known = N.FACTORY_CLASSES.includes(name) || N.RAW_TYPES.includes(name);\n const framework = facts.classAliases.get(name) ?? (known ? name : undefined);\n if (framework !== undefined && N.FACTORY_CLASSES.includes(framework)) return Origin.FACTORY;\n if (framework === 'IpcConnection') return Origin.CONNECTION;\n if (facts.transportImports.has(name)) return Origin.TRANSPORT;\n if (facts.webviewTypes.has(name)) return Origin.WEBVIEW;\n return undefined;\n }\n\n private originOfValue(value: ts.Expression | undefined, facts: FileFacts): Origin | undefined {\n if (value === undefined) return undefined;\n if (ts.isNewExpression(value)) {\n const constructed = this.constructedName(value, facts);\n return constructed === undefined ? undefined : this.originOfClassName(constructed, facts);\n }\n const tracked = this.originOfReceiver(value, facts);\n if (tracked !== undefined) return tracked;\n return N.WEBVIEW_RECEIVER.test(value.getText()) ? Origin.WEBVIEW : undefined;\n }\n\n /** What `expr` holds when it is a tracked name, `this.<tracked>`, or a namespace import. */\n private originOfReceiver(expr: ts.Expression, facts: FileFacts): Origin | undefined {\n const node = this.unwrap(expr);\n if (ts.isIdentifier(node)) return facts.origins.get(node.text);\n if (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.ThisKeyword) {\n return facts.origins.get(node.name.text);\n }\n return undefined;\n }\n\n /** The framework/transport class a `new` builds, through import renames, aliases and namespaces. */\n private constructedName(node: ts.NewExpression, facts: FileFacts): string | undefined {\n const callee = this.unwrap(node.expression);\n if (ts.isIdentifier(callee)) return facts.classAliases.get(callee.text) ?? callee.text;\n if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression)) {\n if (facts.namespaces.has(callee.expression.text)) return callee.name.text;\n }\n return undefined;\n }\n\n private judgeBinding(file: IpcSourceFile, binding: IpcImportBinding, role: IpcFileRole): IpcFinding[] {\n const out: IpcFinding[] = [];\n const isCoreRaw = binding.moduleSpecifier === N.CORE_IPC_MODULE && N.RAW_TYPES.includes(binding.imported);\n if (isCoreRaw && !role.transport && !role.composition) out.push(file.finding(binding.node, R.COMPOSITION));\n const target = this.resolver.resolve(file.relFile, binding.moduleSpecifier);\n if (target !== undefined && this.policy.isTransportFile(target) && !role.bootstrap) {\n const raw = N.TRANSPORT_RAW_EXPORTS.includes(binding.imported) && !role.transport;\n const client = binding.imported === 'createClient' && !role.composition;\n if (raw || client) out.push(file.finding(binding.node, R.COMPOSITION));\n }\n const legacy = this.policy.legacyNames.has(binding.imported) && !binding.typeOnly;\n const allowed = role.bootstrap && this.policy.config.bootstrapAllowedLegacyNames.includes(binding.imported);\n if (legacy && (role.transport || role.bootstrap) && !allowed) out.push(file.finding(binding.node, R.LEGACY_CONSTANT));\n return out;\n }\n\n private judgeNode(file: IpcSourceFile, node: ts.Node, role: IpcFileRole, facts: FileFacts): IpcFinding[] {\n if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) return this.judgeModuleDeclaration(file, node, role);\n if (ts.isCallExpression(node)) return this.judgeDynamicLoad(file, node, role);\n if (ts.isClassDeclaration(node)) return this.judgeClassName(file, node);\n if (ts.isNewExpression(node)) return this.judgeConstruction(file, node, role, facts);\n if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {\n return this.judgeMember(file, node, role, facts);\n }\n if (ts.isBindingElement(node)) return this.judgeDestructure(file, node, role, facts);\n if (ts.isIdentifier(node) && this.policy.config.retiredIdentifiers.includes(node.text)) {\n return [file.finding(node, R.RETIRED_IDENTIFIER)];\n }\n if ((role.transport || role.bootstrap) && ts.isStringLiteral(node)) return this.judgeLegacyCommand(file, node);\n return [];\n }\n\n private judgeModuleDeclaration(\n file: IpcSourceFile,\n node: ts.ImportDeclaration | ts.ExportDeclaration,\n role: IpcFileRole,\n ): IpcFinding[] {\n const specifierNode = node.moduleSpecifier;\n if (specifierNode === undefined || !ts.isStringLiteral(specifierNode)) return [];\n const specifier = specifierNode.text;\n const out: IpcFinding[] = [];\n if (this.policy.config.testOnlyModuleSuffixes.some((suffix: string) => this.endsWithModule(specifier, suffix))) {\n out.push(file.finding(node, R.TEST_SUPPORT));\n }\n if (this.policy.config.retiredModules.includes(specifier)) out.push(file.finding(node, R.RETIRED_MODULE));\n if (specifier === N.BRIDGE_MODULE && !role.composition) out.push(file.finding(node, R.COMPOSITION));\n return out;\n }\n\n private endsWithModule(specifier: string, suffix: string): boolean {\n return specifier.endsWith(suffix) || specifier.endsWith(`${suffix}.js`) || specifier.endsWith(`${suffix}.ts`);\n }\n\n private judgeDynamicLoad(file: IpcSourceFile, node: ts.CallExpression, role: IpcFileRole): IpcFinding[] {\n const loader = node.expression.kind === ts.SyntaxKind.ImportKeyword ||\n (ts.isIdentifier(node.expression) && node.expression.text === 'require');\n const first = node.arguments[0];\n if (!loader || first === undefined || !ts.isStringLiteralLike(first)) return [];\n if (this.policy.config.retiredModules.includes(first.text)) return [file.finding(node, R.RETIRED_MODULE)];\n if (first.text === N.BRIDGE_MODULE && !role.composition) return [file.finding(node, R.COMPOSITION)];\n return [];\n }\n\n private judgeClassName(file: IpcSourceFile, node: ts.ClassDeclaration): IpcFinding[] {\n const name = node.name?.text;\n if (name === undefined) return [];\n const refused = this.policy.classPatterns.some((pattern: RegExp) => pattern.test(name));\n return refused ? [file.finding(node.name ?? node, R.HANDWRITTEN_CLIENT)] : [];\n }\n\n private judgeConstruction(file: IpcSourceFile, node: ts.NewExpression, role: IpcFileRole, facts: FileFacts): IpcFinding[] {\n const name = this.constructedName(node, facts);\n if (name === undefined) return [];\n if (N.FACTORY_CLASSES.includes(name) && !role.composition) return [file.finding(node, R.COMPOSITION)];\n if (N.RAW_CONSTRUCTIBLE.includes(name) && !role.transport) return [file.finding(node, R.COMPOSITION)];\n return [];\n }\n\n private judgeMember(\n file: IpcSourceFile,\n node: ts.PropertyAccessExpression | ts.ElementAccessExpression,\n role: IpcFileRole,\n facts: FileFacts,\n ): IpcFinding[] {\n const member = this.memberName(node);\n if (member === undefined) return [];\n const origin = this.originOfReceiver(node.expression, facts);\n const webview = origin === Origin.WEBVIEW || N.WEBVIEW_RECEIVER.test(node.expression.getText());\n const rawDelivery = member === 'injectJavaScript' || (member === 'postMessage' && webview);\n if (rawDelivery && !role.transport && !role.bootstrap) return [file.finding(node, R.COMPOSITION)];\n if (origin === Origin.FACTORY && N.FACTORY_METHODS.includes(member) && !role.composition) {\n return [file.finding(node, R.COMPOSITION)];\n }\n if (origin === Origin.CONNECTION && N.CONNECTION_METHODS.includes(member) && !role.transport) {\n return [file.finding(node, R.COMPOSITION)];\n }\n if (origin === Origin.TRANSPORT && !role.bootstrap) {\n const raw = N.TRANSPORT_RAW_EXPORTS.includes(member) && !role.transport;\n const client = member === 'createClient' && !role.composition;\n if (raw || client) return [file.finding(node, R.COMPOSITION)];\n }\n return [];\n }\n\n private memberName(node: ts.PropertyAccessExpression | ts.ElementAccessExpression): string | undefined {\n if (ts.isPropertyAccessExpression(node)) return node.name.text;\n return ts.isStringLiteralLike(node.argumentExpression) ? node.argumentExpression.text : undefined;\n }\n\n private judgeDestructure(file: IpcSourceFile, node: ts.BindingElement, role: IpcFileRole, facts: FileFacts): IpcFinding[] {\n if (role.transport) return [];\n const key = node.propertyName ?? node.name;\n const name = ts.isIdentifier(key) || ts.isStringLiteral(key) ? key.text : undefined;\n if (name === undefined || !N.WEBVIEW_RAW_MEMBERS.includes(name)) return [];\n const declaration = node.parent.parent;\n if (!ts.isVariableDeclaration(declaration) || declaration.initializer === undefined) return [];\n const source = declaration.initializer;\n const webview = this.originOfReceiver(source, facts) === Origin.WEBVIEW || N.WEBVIEW_RECEIVER.test(source.getText());\n return webview ? [file.finding(node, R.COMPOSITION)] : [];\n }\n\n private judgeLegacyCommand(file: IpcSourceFile, node: ts.StringLiteral): IpcFinding[] {\n const legacy = this.policy.config.legacyWireCommandPrefixes.some((prefix: string) => node.text.startsWith(prefix));\n return legacy ? [file.finding(node, R.LEGACY_COMMAND)] : [];\n }\n\n private unwrap(expr: ts.Expression): ts.Expression {\n let node = expr;\n while (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isNonNullExpression(node) || ts.isSatisfiesExpression(node)) {\n node = node.expression;\n }\n return node;\n }\n}\n"]}