@opensip-cli/graph-typescript 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/_pipeline.d.ts +40 -0
- package/dist/__tests__/_pipeline.d.ts.map +1 -0
- package/dist/__tests__/_pipeline.js +67 -0
- package/dist/__tests__/_pipeline.js.map +1 -0
- package/dist/__tests__/acceptance/_fixture-runner.d.ts +13 -0
- package/dist/__tests__/acceptance/_fixture-runner.d.ts.map +1 -0
- package/dist/__tests__/acceptance/_fixture-runner.js +55 -0
- package/dist/__tests__/acceptance/_fixture-runner.js.map +1 -0
- package/dist/__tests__/acceptance/alias-resolution.test.d.ts +8 -0
- package/dist/__tests__/acceptance/alias-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/alias-resolution.test.js +39 -0
- package/dist/__tests__/acceptance/alias-resolution.test.js.map +1 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.d.ts +8 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.js +33 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.js.map +1 -0
- package/dist/__tests__/acceptance/constructor-calls.test.d.ts +7 -0
- package/dist/__tests__/acceptance/constructor-calls.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/constructor-calls.test.js +36 -0
- package/dist/__tests__/acceptance/constructor-calls.test.js.map +1 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.d.ts +8 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.js +44 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.js.map +1 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.d.ts +9 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.js +72 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.js.map +1 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.d.ts +7 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.js +46 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.js.map +1 -0
- package/dist/__tests__/acceptance/module-init.test.d.ts +10 -0
- package/dist/__tests__/acceptance/module-init.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/module-init.test.js +40 -0
- package/dist/__tests__/acceptance/module-init.test.js.map +1 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.d.ts +7 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.js +51 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.js.map +1 -0
- package/dist/__tests__/body-twin-edges.test.d.ts +12 -0
- package/dist/__tests__/body-twin-edges.test.d.ts.map +1 -0
- package/dist/__tests__/body-twin-edges.test.js +85 -0
- package/dist/__tests__/body-twin-edges.test.js.map +1 -0
- package/dist/__tests__/cache-key.test.d.ts +8 -0
- package/dist/__tests__/cache-key.test.d.ts.map +1 -0
- package/dist/__tests__/cache-key.test.js +86 -0
- package/dist/__tests__/cache-key.test.js.map +1 -0
- package/dist/__tests__/depends-on-emission.test.d.ts +19 -0
- package/dist/__tests__/depends-on-emission.test.d.ts.map +1 -0
- package/dist/__tests__/depends-on-emission.test.js +165 -0
- package/dist/__tests__/depends-on-emission.test.js.map +1 -0
- package/dist/__tests__/discover.test.d.ts +9 -0
- package/dist/__tests__/discover.test.d.ts.map +1 -0
- package/dist/__tests__/discover.test.js +72 -0
- package/dist/__tests__/discover.test.js.map +1 -0
- package/dist/__tests__/edge-helpers/method-target.test.d.ts +8 -0
- package/dist/__tests__/edge-helpers/method-target.test.d.ts.map +1 -0
- package/dist/__tests__/edge-helpers/method-target.test.js +96 -0
- package/dist/__tests__/edge-helpers/method-target.test.js.map +1 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.d.ts +13 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.d.ts.map +1 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.js +176 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.js.map +1 -0
- package/dist/__tests__/edge-resolvers/branches.test.d.ts +11 -0
- package/dist/__tests__/edge-resolvers/branches.test.d.ts.map +1 -0
- package/dist/__tests__/edge-resolvers/branches.test.js +305 -0
- package/dist/__tests__/edge-resolvers/branches.test.js.map +1 -0
- package/dist/__tests__/edge-resolvers/contract.test.d.ts +8 -0
- package/dist/__tests__/edge-resolvers/contract.test.d.ts.map +1 -0
- package/dist/__tests__/edge-resolvers/contract.test.js +30 -0
- package/dist/__tests__/edge-resolvers/contract.test.js.map +1 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.d.ts +17 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.d.ts.map +1 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.js +286 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.js.map +1 -0
- package/dist/__tests__/fast-vs-exact.test.d.ts +16 -0
- package/dist/__tests__/fast-vs-exact.test.d.ts.map +1 -0
- package/dist/__tests__/fast-vs-exact.test.js +116 -0
- package/dist/__tests__/fast-vs-exact.test.js.map +1 -0
- package/dist/__tests__/graph-cli.test.d.ts +9 -0
- package/dist/__tests__/graph-cli.test.d.ts.map +1 -0
- package/dist/__tests__/graph-cli.test.js +417 -0
- package/dist/__tests__/graph-cli.test.js.map +1 -0
- package/dist/__tests__/heap-preflight.test.d.ts +10 -0
- package/dist/__tests__/heap-preflight.test.d.ts.map +1 -0
- package/dist/__tests__/heap-preflight.test.js +166 -0
- package/dist/__tests__/heap-preflight.test.js.map +1 -0
- package/dist/__tests__/inventory-differential.test.d.ts +15 -0
- package/dist/__tests__/inventory-differential.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-differential.test.js +319 -0
- package/dist/__tests__/inventory-differential.test.js.map +1 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.d.ts +11 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.js +34 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.js.map +1 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.d.ts +9 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.js +30 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.js.map +1 -0
- package/dist/__tests__/inventory-property-tests.test.d.ts +24 -0
- package/dist/__tests__/inventory-property-tests.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-property-tests.test.js +521 -0
- package/dist/__tests__/inventory-property-tests.test.js.map +1 -0
- package/dist/__tests__/inventory-shape-coverage.test.d.ts +16 -0
- package/dist/__tests__/inventory-shape-coverage.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-shape-coverage.test.js +586 -0
- package/dist/__tests__/inventory-shape-coverage.test.js.map +1 -0
- package/dist/__tests__/inventory-visitors/contract.test.d.ts +9 -0
- package/dist/__tests__/inventory-visitors/contract.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-visitors/contract.test.js +33 -0
- package/dist/__tests__/inventory-visitors/contract.test.js.map +1 -0
- package/dist/__tests__/lang-adapter-contract.test.d.ts +19 -0
- package/dist/__tests__/lang-adapter-contract.test.d.ts.map +1 -0
- package/dist/__tests__/lang-adapter-contract.test.js +880 -0
- package/dist/__tests__/lang-adapter-contract.test.js.map +1 -0
- package/dist/__tests__/lang-adapter-registry.test.d.ts +10 -0
- package/dist/__tests__/lang-adapter-registry.test.d.ts.map +1 -0
- package/dist/__tests__/lang-adapter-registry.test.js +151 -0
- package/dist/__tests__/lang-adapter-registry.test.js.map +1 -0
- package/dist/__tests__/normalize-project-dir.test.d.ts +5 -0
- package/dist/__tests__/normalize-project-dir.test.d.ts.map +1 -0
- package/dist/__tests__/normalize-project-dir.test.js +47 -0
- package/dist/__tests__/normalize-project-dir.test.js.map +1 -0
- package/dist/__tests__/orchestrate.test.d.ts +8 -0
- package/dist/__tests__/orchestrate.test.d.ts.map +1 -0
- package/dist/__tests__/orchestrate.test.js +213 -0
- package/dist/__tests__/orchestrate.test.js.map +1 -0
- package/dist/__tests__/parse-fast.test.d.ts +9 -0
- package/dist/__tests__/parse-fast.test.d.ts.map +1 -0
- package/dist/__tests__/parse-fast.test.js +114 -0
- package/dist/__tests__/parse-fast.test.js.map +1 -0
- package/dist/__tests__/rules/_helpers.d.ts +18 -0
- package/dist/__tests__/rules/_helpers.d.ts.map +1 -0
- package/dist/__tests__/rules/_helpers.js +62 -0
- package/dist/__tests__/rules/_helpers.js.map +1 -0
- package/dist/__tests__/rules/duplicated-function-body.test.d.ts +5 -0
- package/dist/__tests__/rules/duplicated-function-body.test.d.ts.map +1 -0
- package/dist/__tests__/rules/duplicated-function-body.test.js +39 -0
- package/dist/__tests__/rules/duplicated-function-body.test.js.map +1 -0
- package/dist/__tests__/rules/orphan-subtree.test.d.ts +5 -0
- package/dist/__tests__/rules/orphan-subtree.test.d.ts.map +1 -0
- package/dist/__tests__/rules/orphan-subtree.test.js +75 -0
- package/dist/__tests__/rules/orphan-subtree.test.js.map +1 -0
- package/dist/__tests__/rules/rule-hints-integration.test.d.ts +20 -0
- package/dist/__tests__/rules/rule-hints-integration.test.d.ts.map +1 -0
- package/dist/__tests__/rules/rule-hints-integration.test.js +279 -0
- package/dist/__tests__/rules/rule-hints-integration.test.js.map +1 -0
- package/dist/__tests__/tool-register.test.d.ts +16 -0
- package/dist/__tests__/tool-register.test.d.ts.map +1 -0
- package/dist/__tests__/tool-register.test.js +210 -0
- package/dist/__tests__/tool-register.test.js.map +1 -0
- package/dist/__tests__/value-reference-unit.test.d.ts +13 -0
- package/dist/__tests__/value-reference-unit.test.d.ts.map +1 -0
- package/dist/__tests__/value-reference-unit.test.js +226 -0
- package/dist/__tests__/value-reference-unit.test.js.map +1 -0
- package/dist/__tests__/value-reference.test.d.ts +15 -0
- package/dist/__tests__/value-reference.test.d.ts.map +1 -0
- package/dist/__tests__/value-reference.test.js +115 -0
- package/dist/__tests__/value-reference.test.js.map +1 -0
- package/dist/__tests__/walk-fast.test.d.ts +8 -0
- package/dist/__tests__/walk-fast.test.d.ts.map +1 -0
- package/dist/__tests__/walk-fast.test.js +51 -0
- package/dist/__tests__/walk-fast.test.js.map +1 -0
- package/dist/__tests__/walk-reexports.test.d.ts +7 -0
- package/dist/__tests__/walk-reexports.test.d.ts.map +1 -0
- package/dist/__tests__/walk-reexports.test.js +79 -0
- package/dist/__tests__/walk-reexports.test.js.map +1 -0
- package/dist/cache-key.d.ts +41 -0
- package/dist/cache-key.d.ts.map +1 -0
- package/dist/cache-key.js +94 -0
- package/dist/cache-key.js.map +1 -0
- package/dist/discover.d.ts +25 -0
- package/dist/discover.d.ts.map +1 -0
- package/dist/discover.js +124 -0
- package/dist/discover.js.map +1 -0
- package/dist/edge-helpers/cross-package-context.d.ts +34 -0
- package/dist/edge-helpers/cross-package-context.d.ts.map +1 -0
- package/dist/edge-helpers/cross-package-context.js +97 -0
- package/dist/edge-helpers/cross-package-context.js.map +1 -0
- package/dist/edge-helpers/declaration-to-node.d.ts +58 -0
- package/dist/edge-helpers/declaration-to-node.d.ts.map +1 -0
- package/dist/edge-helpers/declaration-to-node.js +93 -0
- package/dist/edge-helpers/declaration-to-node.js.map +1 -0
- package/dist/edge-helpers/find-catalog-entry.d.ts +24 -0
- package/dist/edge-helpers/find-catalog-entry.d.ts.map +1 -0
- package/dist/edge-helpers/find-catalog-entry.js +45 -0
- package/dist/edge-helpers/find-catalog-entry.js.map +1 -0
- package/dist/edge-helpers/method-target.d.ts +22 -0
- package/dist/edge-helpers/method-target.d.ts.map +1 -0
- package/dist/edge-helpers/method-target.js +46 -0
- package/dist/edge-helpers/method-target.js.map +1 -0
- package/dist/edge-helpers/resolution-trace.d.ts +24 -0
- package/dist/edge-helpers/resolution-trace.d.ts.map +1 -0
- package/dist/edge-helpers/resolution-trace.js +38 -0
- package/dist/edge-helpers/resolution-trace.js.map +1 -0
- package/dist/edge-helpers/resolve-decl.d.ts +44 -0
- package/dist/edge-helpers/resolve-decl.d.ts.map +1 -0
- package/dist/edge-helpers/resolve-decl.js +170 -0
- package/dist/edge-helpers/resolve-decl.js.map +1 -0
- package/dist/edge-helpers/unalias-symbol.d.ts +10 -0
- package/dist/edge-helpers/unalias-symbol.d.ts.map +1 -0
- package/dist/edge-helpers/unalias-symbol.js +29 -0
- package/dist/edge-helpers/unalias-symbol.js.map +1 -0
- package/dist/edge-resolvers/__tests__/boundary.test.d.ts +15 -0
- package/dist/edge-resolvers/__tests__/boundary.test.d.ts.map +1 -0
- package/dist/edge-resolvers/__tests__/boundary.test.js +227 -0
- package/dist/edge-resolvers/__tests__/boundary.test.js.map +1 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.d.ts +10 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.d.ts.map +1 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.js +63 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.js.map +1 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.d.ts +12 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.d.ts.map +1 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.js +215 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.js.map +1 -0
- package/dist/edge-resolvers/boundary.d.ts +41 -0
- package/dist/edge-resolvers/boundary.d.ts.map +1 -0
- package/dist/edge-resolvers/boundary.js +130 -0
- package/dist/edge-resolvers/boundary.js.map +1 -0
- package/dist/edge-resolvers/catalog-fallback.d.ts +13 -0
- package/dist/edge-resolvers/catalog-fallback.d.ts.map +1 -0
- package/dist/edge-resolvers/catalog-fallback.js +30 -0
- package/dist/edge-resolvers/catalog-fallback.js.map +1 -0
- package/dist/edge-resolvers/direct-call.d.ts +10 -0
- package/dist/edge-resolvers/direct-call.d.ts.map +1 -0
- package/dist/edge-resolvers/direct-call.js +45 -0
- package/dist/edge-resolvers/direct-call.js.map +1 -0
- package/dist/edge-resolvers/jsx-element.d.ts +16 -0
- package/dist/edge-resolvers/jsx-element.d.ts.map +1 -0
- package/dist/edge-resolvers/jsx-element.js +67 -0
- package/dist/edge-resolvers/jsx-element.js.map +1 -0
- package/dist/edge-resolvers/new-expression.d.ts +11 -0
- package/dist/edge-resolvers/new-expression.d.ts.map +1 -0
- package/dist/edge-resolvers/new-expression.js +56 -0
- package/dist/edge-resolvers/new-expression.js.map +1 -0
- package/dist/edge-resolvers/polymorphic.d.ts +8 -0
- package/dist/edge-resolvers/polymorphic.d.ts.map +1 -0
- package/dist/edge-resolvers/polymorphic.js +57 -0
- package/dist/edge-resolvers/polymorphic.js.map +1 -0
- package/dist/edge-resolvers/property-access.d.ts +10 -0
- package/dist/edge-resolvers/property-access.d.ts.map +1 -0
- package/dist/edge-resolvers/property-access.js +56 -0
- package/dist/edge-resolvers/property-access.js.map +1 -0
- package/dist/edge-resolvers/syntactic.d.ts +105 -0
- package/dist/edge-resolvers/syntactic.d.ts.map +1 -0
- package/dist/edge-resolvers/syntactic.js +294 -0
- package/dist/edge-resolvers/syntactic.js.map +1 -0
- package/dist/edge-resolvers/types.d.ts +37 -0
- package/dist/edge-resolvers/types.d.ts.map +1 -0
- package/dist/edge-resolvers/types.js +10 -0
- package/dist/edge-resolvers/types.js.map +1 -0
- package/dist/edges-value-reference.d.ts +26 -0
- package/dist/edges-value-reference.d.ts.map +1 -0
- package/dist/edges-value-reference.js +138 -0
- package/dist/edges-value-reference.js.map +1 -0
- package/dist/edges.d.ts +65 -0
- package/dist/edges.d.ts.map +1 -0
- package/dist/edges.js +392 -0
- package/dist/edges.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +346 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory-helpers/classify-visibility.d.ts +13 -0
- package/dist/inventory-helpers/classify-visibility.d.ts.map +1 -0
- package/dist/inventory-helpers/classify-visibility.js +56 -0
- package/dist/inventory-helpers/classify-visibility.js.map +1 -0
- package/dist/inventory-helpers/extract-decorators.d.ts +6 -0
- package/dist/inventory-helpers/extract-decorators.d.ts.map +1 -0
- package/dist/inventory-helpers/extract-decorators.js +33 -0
- package/dist/inventory-helpers/extract-decorators.js.map +1 -0
- package/dist/inventory-helpers/extract-params.d.ts +7 -0
- package/dist/inventory-helpers/extract-params.d.ts.map +1 -0
- package/dist/inventory-helpers/extract-params.js +28 -0
- package/dist/inventory-helpers/extract-params.js.map +1 -0
- package/dist/inventory-helpers/hash-body.d.ts +43 -0
- package/dist/inventory-helpers/hash-body.d.ts.map +1 -0
- package/dist/inventory-helpers/hash-body.js +52 -0
- package/dist/inventory-helpers/hash-body.js.map +1 -0
- package/dist/inventory-helpers/synthesize-name.d.ts +16 -0
- package/dist/inventory-helpers/synthesize-name.d.ts.map +1 -0
- package/dist/inventory-helpers/synthesize-name.js +17 -0
- package/dist/inventory-helpers/synthesize-name.js.map +1 -0
- package/dist/inventory-visitors/arrow-function.d.ts +8 -0
- package/dist/inventory-visitors/arrow-function.d.ts.map +1 -0
- package/dist/inventory-visitors/arrow-function.js +55 -0
- package/dist/inventory-visitors/arrow-function.js.map +1 -0
- package/dist/inventory-visitors/class-static-init.d.ts +17 -0
- package/dist/inventory-visitors/class-static-init.d.ts.map +1 -0
- package/dist/inventory-visitors/class-static-init.js +45 -0
- package/dist/inventory-visitors/class-static-init.js.map +1 -0
- package/dist/inventory-visitors/constructor-declaration.d.ts +7 -0
- package/dist/inventory-visitors/constructor-declaration.d.ts.map +1 -0
- package/dist/inventory-visitors/constructor-declaration.js +47 -0
- package/dist/inventory-visitors/constructor-declaration.js.map +1 -0
- package/dist/inventory-visitors/function-declaration.d.ts +7 -0
- package/dist/inventory-visitors/function-declaration.d.ts.map +1 -0
- package/dist/inventory-visitors/function-declaration.js +59 -0
- package/dist/inventory-visitors/function-declaration.js.map +1 -0
- package/dist/inventory-visitors/function-expression.d.ts +7 -0
- package/dist/inventory-visitors/function-expression.d.ts.map +1 -0
- package/dist/inventory-visitors/function-expression.js +56 -0
- package/dist/inventory-visitors/function-expression.js.map +1 -0
- package/dist/inventory-visitors/getter-setter.d.ts +7 -0
- package/dist/inventory-visitors/getter-setter.d.ts.map +1 -0
- package/dist/inventory-visitors/getter-setter.js +63 -0
- package/dist/inventory-visitors/getter-setter.js.map +1 -0
- package/dist/inventory-visitors/method-declaration.d.ts +7 -0
- package/dist/inventory-visitors/method-declaration.d.ts.map +1 -0
- package/dist/inventory-visitors/method-declaration.js +75 -0
- package/dist/inventory-visitors/method-declaration.js.map +1 -0
- package/dist/inventory-visitors/module-init.d.ts +15 -0
- package/dist/inventory-visitors/module-init.d.ts.map +1 -0
- package/dist/inventory-visitors/module-init.js +40 -0
- package/dist/inventory-visitors/module-init.js.map +1 -0
- package/dist/inventory-visitors/types.d.ts +26 -0
- package/dist/inventory-visitors/types.d.ts.map +1 -0
- package/dist/inventory-visitors/types.js +14 -0
- package/dist/inventory-visitors/types.js.map +1 -0
- package/dist/normalize-project-dir.d.ts +14 -0
- package/dist/normalize-project-dir.d.ts.map +1 -0
- package/dist/normalize-project-dir.js +36 -0
- package/dist/normalize-project-dir.js.map +1 -0
- package/dist/parse-fast.d.ts +41 -0
- package/dist/parse-fast.d.ts.map +1 -0
- package/dist/parse-fast.js +91 -0
- package/dist/parse-fast.js.map +1 -0
- package/dist/parse.d.ts +42 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +75 -0
- package/dist/parse.js.map +1 -0
- package/dist/test-file.d.ts +7 -0
- package/dist/test-file.d.ts.map +1 -0
- package/dist/test-file.js +42 -0
- package/dist/test-file.js.map +1 -0
- package/dist/walk.d.ts +125 -0
- package/dist/walk.d.ts.map +1 -0
- package/dist/walk.js +393 -0
- package/dist/walk.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesizes one `<module-init>` occurrence per file.
|
|
3
|
+
*
|
|
4
|
+
* Per spec §2.2: "produces ONE module-init occurrence per file, owning
|
|
5
|
+
* all top-level call sites discovered in stage 2."
|
|
6
|
+
*
|
|
7
|
+
* PR-5 documents that this visitor is the deliberate outlier — it does
|
|
8
|
+
* not implement the InventoryVisitor signature because it walks all
|
|
9
|
+
* top-level statements rather than dispatching on a single node.
|
|
10
|
+
*/
|
|
11
|
+
import { digestSyntheticBody } from '../inventory-helpers/hash-body.js';
|
|
12
|
+
import { synthesizeModuleInitName } from '../inventory-helpers/synthesize-name.js';
|
|
13
|
+
export function synthesizeModuleInit(sourceFile, ctx) {
|
|
14
|
+
// Hash the file's top-level statement-text concatenation. Every
|
|
15
|
+
// top-level statement contributes; per-function bodies do not (they
|
|
16
|
+
// get their own occurrences).
|
|
17
|
+
const topLevelText = sourceFile.statements.map((s) => s.getText(sourceFile)).join('\n');
|
|
18
|
+
const name = synthesizeModuleInitName(ctx.filePathProjectRel);
|
|
19
|
+
const digest = digestSyntheticBody(`${ctx.filePathProjectRel}\n${topLevelText}`);
|
|
20
|
+
return {
|
|
21
|
+
bodyHash: digest.hash,
|
|
22
|
+
bodySize: digest.size,
|
|
23
|
+
simpleName: name,
|
|
24
|
+
qualifiedName: `${ctx.filePathProjectRel.replace(/\.tsx?$/, '')}.<module-init>`,
|
|
25
|
+
filePath: ctx.filePathProjectRel,
|
|
26
|
+
line: 1,
|
|
27
|
+
column: 0,
|
|
28
|
+
endLine: sourceFile.getLineAndCharacterOfPosition(sourceFile.getEnd()).line + 1,
|
|
29
|
+
kind: 'module-init',
|
|
30
|
+
params: [],
|
|
31
|
+
returnType: null,
|
|
32
|
+
enclosingClass: null,
|
|
33
|
+
decorators: [],
|
|
34
|
+
visibility: 'module-local',
|
|
35
|
+
inTestFile: ctx.inTestFile,
|
|
36
|
+
definedInGenerated: ctx.definedInGenerated,
|
|
37
|
+
calls: [],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=module-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-init.js","sourceRoot":"","sources":["../../src/inventory-visitors/module-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAMnF,MAAM,UAAU,oBAAoB,CAClC,UAAyB,EACzB,GAAmB;IAEnB,gEAAgE;IAChE,oEAAoE;IACpE,8BAA8B;IAC9B,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxF,MAAM,IAAI,GAAG,wBAAwB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,GAAG,CAAC,kBAAkB,KAAK,YAAY,EAAE,CAAC,CAAC;IACjF,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,IAAI;QACrB,QAAQ,EAAE,MAAM,CAAC,IAAI;QACrB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB;QAC/E,QAAQ,EAAE,GAAG,CAAC,kBAAkB;QAChC,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;QAC/E,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,cAAc;QAC1B,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;QAC1C,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InventoryVisitor signature alias (PR-5).
|
|
3
|
+
*
|
|
4
|
+
* Six of the seven inventory visitors (function-declaration,
|
|
5
|
+
* arrow-function, method-declaration, constructor-declaration,
|
|
6
|
+
* getter-setter, function-expression) conform to this shape.
|
|
7
|
+
*
|
|
8
|
+
* `module-init.ts` is the deliberate outlier — it walks all top-level
|
|
9
|
+
* statements of a SourceFile and synthesizes one occurrence per file,
|
|
10
|
+
* rather than dispatching on a single node. It does not implement
|
|
11
|
+
* InventoryVisitor; PR-5 calls this out explicitly.
|
|
12
|
+
*/
|
|
13
|
+
import type { FunctionOccurrence } from '@opensip-cli/graph';
|
|
14
|
+
import type ts from 'typescript';
|
|
15
|
+
/** Per-source-file context carried through every inventory visitor invocation. */
|
|
16
|
+
export interface VisitorContext {
|
|
17
|
+
readonly sourceFile: ts.SourceFile;
|
|
18
|
+
readonly projectDirAbs: string;
|
|
19
|
+
readonly filePathProjectRel: string;
|
|
20
|
+
readonly inTestFile: boolean;
|
|
21
|
+
readonly definedInGenerated: boolean;
|
|
22
|
+
/** Class node currently being walked (set when inside a class declaration). */
|
|
23
|
+
readonly enclosingClass: string | null;
|
|
24
|
+
}
|
|
25
|
+
export type InventoryVisitor<N extends ts.Node = ts.Node> = (node: N, ctx: VisitorContext) => FunctionOccurrence | null;
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/inventory-visitors/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,IAAI,CAC1D,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,cAAc,KAChB,kBAAkB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InventoryVisitor signature alias (PR-5).
|
|
3
|
+
*
|
|
4
|
+
* Six of the seven inventory visitors (function-declaration,
|
|
5
|
+
* arrow-function, method-declaration, constructor-declaration,
|
|
6
|
+
* getter-setter, function-expression) conform to this shape.
|
|
7
|
+
*
|
|
8
|
+
* `module-init.ts` is the deliberate outlier — it walks all top-level
|
|
9
|
+
* statements of a SourceFile and synthesizes one occurrence per file,
|
|
10
|
+
* rather than dispatching on a single node. It does not implement
|
|
11
|
+
* InventoryVisitor; PR-5 calls this out explicitly.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/inventory-visitors/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility — normalize a project directory path.
|
|
3
|
+
*
|
|
4
|
+
* Two callers per spec §2.1: stage 0 (discover) and stage 2 (edges).
|
|
5
|
+
* Cache invalidation also normalizes tsConfigPath the same way, making
|
|
6
|
+
* three callers and justifying extraction (rule of three).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Normalize a project directory: resolve to absolute, then realpath
|
|
10
|
+
* (follows symlinks). Throws ConfigurationError if missing or not a
|
|
11
|
+
* directory.
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeProjectDir(input: string): string;
|
|
14
|
+
//# sourceMappingURL=normalize-project-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-project-dir.d.ts","sourceRoot":"","sources":["../src/normalize-project-dir.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBzD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility — normalize a project directory path.
|
|
3
|
+
*
|
|
4
|
+
* Two callers per spec §2.1: stage 0 (discover) and stage 2 (edges).
|
|
5
|
+
* Cache invalidation also normalizes tsConfigPath the same way, making
|
|
6
|
+
* three callers and justifying extraction (rule of three).
|
|
7
|
+
*/
|
|
8
|
+
import { realpathSync, statSync } from 'node:fs';
|
|
9
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
10
|
+
import { ConfigurationError } from '@opensip-cli/core';
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a project directory: resolve to absolute, then realpath
|
|
13
|
+
* (follows symlinks). Throws ConfigurationError if missing or not a
|
|
14
|
+
* directory.
|
|
15
|
+
*/
|
|
16
|
+
export function normalizeProjectDir(input) {
|
|
17
|
+
const absolute = isAbsolute(input) ? input : resolve(input);
|
|
18
|
+
let stat;
|
|
19
|
+
try {
|
|
20
|
+
stat = statSync(absolute);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
throw new ConfigurationError(`Project directory does not exist: ${input}`);
|
|
24
|
+
}
|
|
25
|
+
if (!stat.isDirectory()) {
|
|
26
|
+
throw new ConfigurationError(`Project path is not a directory: ${input}`);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return realpathSync(absolute);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
/* v8 ignore next */
|
|
33
|
+
return absolute;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=normalize-project-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-project-dir.js","sourceRoot":"","sources":["../src/normalize-project-dir.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,IAAI,CAAC;IACT,IAAI,CAAC;QACH,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,qCAAqC,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,kBAAkB,CAAC,oCAAoC,KAAK,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,oBAAoB;QACpB,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript fast (checker-free) parse implementation.
|
|
3
|
+
*
|
|
4
|
+
* The exact parse (`parse.ts`) calls `ts.createProgram` and forces
|
|
5
|
+
* `program.getTypeChecker()` — the single most expensive operation in a cold
|
|
6
|
+
* graph build (it binds every file: parent pointers for the walk + symbol
|
|
7
|
+
* tables for the resolver). Fast mode avoids both the Program and the checker.
|
|
8
|
+
*
|
|
9
|
+
* Fast mode needs the parent pointers but NOT the symbol table: it
|
|
10
|
+
* resolves edges syntactically (name + import graph) and never calls the
|
|
11
|
+
* checker. So this path skips `createProgram`/`getTypeChecker` entirely
|
|
12
|
+
* and parses each file standalone via
|
|
13
|
+
* `ts.createSourceFile(..., setParentNodes: true)` — `setParentNodes`
|
|
14
|
+
* populates parent pointers without binding or a checker, the cheap
|
|
15
|
+
* substitute for the forced `getTypeChecker()`.
|
|
16
|
+
*
|
|
17
|
+
* Per contract invariant I-7 (parseProject is total over `files`): every
|
|
18
|
+
* file either parses into the map or surfaces a structured ParseError.
|
|
19
|
+
* Standalone `createSourceFile` always returns a (possibly partial)
|
|
20
|
+
* tree; syntactic problems surface via the node's internal
|
|
21
|
+
* `parseDiagnostics`, which we read per file.
|
|
22
|
+
*/
|
|
23
|
+
import ts from 'typescript';
|
|
24
|
+
import type { ParseInput, ParseOutput } from '@opensip-cli/graph';
|
|
25
|
+
/**
|
|
26
|
+
* Fast-flavored parsed project: a per-file map of standalone
|
|
27
|
+
* `ts.SourceFile`s (abs path → SF), with no `ts.Program` and no type
|
|
28
|
+
* checker. The `kind: 'fast'` discriminant lets the walk and resolve
|
|
29
|
+
* stages branch against {@link import('./parse.js').TsParsed}.
|
|
30
|
+
*/
|
|
31
|
+
export interface TypescriptFastParsedProject {
|
|
32
|
+
readonly kind: 'fast';
|
|
33
|
+
/** Absolute file path → standalone source file (parent pointers set). */
|
|
34
|
+
readonly sourceFiles: ReadonlyMap<string, ts.SourceFile>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse each input file into a standalone `ts.SourceFile` with parent
|
|
38
|
+
* pointers, building no Program and constructing no type checker.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseProjectFast(input: ParseInput): ParseOutput<TypescriptFastParsedProject>;
|
|
41
|
+
//# sourceMappingURL=parse-fast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-fast.d.ts","sourceRoot":"","sources":["../src/parse-fast.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAc,MAAM,oBAAoB,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;CAC1D;AAOD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC,2BAA2B,CAAC,CA4C5F"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// @fitness-ignore-file unbounded-memory -- reads single source files for parsing; per-file memory bounded by source size
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript fast (checker-free) parse implementation.
|
|
4
|
+
*
|
|
5
|
+
* The exact parse (`parse.ts`) calls `ts.createProgram` and forces
|
|
6
|
+
* `program.getTypeChecker()` — the single most expensive operation in a cold
|
|
7
|
+
* graph build (it binds every file: parent pointers for the walk + symbol
|
|
8
|
+
* tables for the resolver). Fast mode avoids both the Program and the checker.
|
|
9
|
+
*
|
|
10
|
+
* Fast mode needs the parent pointers but NOT the symbol table: it
|
|
11
|
+
* resolves edges syntactically (name + import graph) and never calls the
|
|
12
|
+
* checker. So this path skips `createProgram`/`getTypeChecker` entirely
|
|
13
|
+
* and parses each file standalone via
|
|
14
|
+
* `ts.createSourceFile(..., setParentNodes: true)` — `setParentNodes`
|
|
15
|
+
* populates parent pointers without binding or a checker, the cheap
|
|
16
|
+
* substitute for the forced `getTypeChecker()`.
|
|
17
|
+
*
|
|
18
|
+
* Per contract invariant I-7 (parseProject is total over `files`): every
|
|
19
|
+
* file either parses into the map or surfaces a structured ParseError.
|
|
20
|
+
* Standalone `createSourceFile` always returns a (possibly partial)
|
|
21
|
+
* tree; syntactic problems surface via the node's internal
|
|
22
|
+
* `parseDiagnostics`, which we read per file.
|
|
23
|
+
*/
|
|
24
|
+
import { readFileSync } from 'node:fs';
|
|
25
|
+
import { extname, relative } from 'node:path';
|
|
26
|
+
import ts from 'typescript';
|
|
27
|
+
/**
|
|
28
|
+
* Parse each input file into a standalone `ts.SourceFile` with parent
|
|
29
|
+
* pointers, building no Program and constructing no type checker.
|
|
30
|
+
*/
|
|
31
|
+
export function parseProjectFast(input) {
|
|
32
|
+
const compilerOptions = (input.compilerOptions ?? {});
|
|
33
|
+
const scriptTarget = compilerOptions.target ?? ts.ScriptTarget.Latest;
|
|
34
|
+
const sourceFiles = new Map();
|
|
35
|
+
const parseErrors = [];
|
|
36
|
+
for (const fileName of input.files) {
|
|
37
|
+
let text;
|
|
38
|
+
try {
|
|
39
|
+
text = readFileSync(fileName, 'utf8');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
/* v8 ignore next */
|
|
43
|
+
parseErrors.push({
|
|
44
|
+
filePath: relative(input.projectDirAbs, fileName),
|
|
45
|
+
message: error instanceof Error ? error.message : String(error),
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const sourceFile = ts.createSourceFile(fileName, text, scriptTarget,
|
|
50
|
+
// setParentNodes: the cheap substitute for the forced checker —
|
|
51
|
+
// populates parent pointers the walk's parent-chain visitors need.
|
|
52
|
+
true, scriptKindForFile(fileName));
|
|
53
|
+
sourceFiles.set(fileName, sourceFile);
|
|
54
|
+
const diagnostics = sourceFile.parseDiagnostics;
|
|
55
|
+
if (diagnostics && diagnostics.length > 0) {
|
|
56
|
+
const filePath = relative(input.projectDirAbs, fileName);
|
|
57
|
+
for (const diag of diagnostics) {
|
|
58
|
+
parseErrors.push({
|
|
59
|
+
filePath,
|
|
60
|
+
message: ts.flattenDiagnosticMessageText(diag.messageText, '\n'),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { project: { kind: 'fast', sourceFiles }, parseErrors };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Pick the tsc ScriptKind from the file extension so `.tsx`/`.jsx` parse
|
|
69
|
+
* JSX correctly. Standalone `createSourceFile` does not infer the kind
|
|
70
|
+
* from the filename, so it must be supplied explicitly.
|
|
71
|
+
*/
|
|
72
|
+
function scriptKindForFile(fileName) {
|
|
73
|
+
switch (extname(fileName).toLowerCase()) {
|
|
74
|
+
case '.tsx': {
|
|
75
|
+
return ts.ScriptKind.TSX;
|
|
76
|
+
}
|
|
77
|
+
case '.jsx': {
|
|
78
|
+
return ts.ScriptKind.JSX;
|
|
79
|
+
}
|
|
80
|
+
case '.js':
|
|
81
|
+
case '.cjs':
|
|
82
|
+
case '.mjs': {
|
|
83
|
+
return ts.ScriptKind.JS;
|
|
84
|
+
}
|
|
85
|
+
default: {
|
|
86
|
+
// .ts, .cts, .mts and anything else the adapter admitted.
|
|
87
|
+
return ts.ScriptKind.TS;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=parse-fast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-fast.js","sourceRoot":"","sources":["../src/parse-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ifts `ts.createProgram` + the eager `getTypeChecker()` call out of
|
|
5
|
+
* the orchestrator (where they used to live in cli/orchestrate.ts:
|
|
6
|
+
* buildAndResolveCatalog) into the adapter, so the orchestrator no
|
|
7
|
+
* longer imports `'typescript'` after PR 3 of plan
|
|
8
|
+
* docs/plans/10-graph-language-pluggability.md.
|
|
9
|
+
*
|
|
10
|
+
* Per contract invariant I-7 (parseProject is total over `files`):
|
|
11
|
+
* every file in `input.files` either parses successfully or surfaces
|
|
12
|
+
* in `parseErrors`. The TypeScript compiler reports parse problems
|
|
13
|
+
* via diagnostic streams rather than throwing; we surface those that
|
|
14
|
+
* the program emits at the file level into a structured ParseError
|
|
15
|
+
* list.
|
|
16
|
+
*/
|
|
17
|
+
import ts from 'typescript';
|
|
18
|
+
import { type TypescriptFastParsedProject } from './parse-fast.js';
|
|
19
|
+
import type { ParseInput, ParseOutput } from '@opensip-cli/graph';
|
|
20
|
+
/** Parsed TS project (exact tier): the live tsc {@link ts.Program} instance. */
|
|
21
|
+
export interface TypescriptParsedProject {
|
|
22
|
+
readonly program: ts.Program;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The adapter-internal parsed-project shape, discriminated by tier so the
|
|
26
|
+
* walk and resolve stages can branch:
|
|
27
|
+
* - exact: `{ kind: 'exact', program }` — the live `ts.Program`; the checker
|
|
28
|
+
* is constructed lazily by the resolve stage.
|
|
29
|
+
* - fast: `{ kind: 'fast', sourceFiles }` — standalone source files, no checker.
|
|
30
|
+
* The engine treats this as opaque `unknown`; only the TS adapter introspects it.
|
|
31
|
+
*/
|
|
32
|
+
export type TsParsed = ({
|
|
33
|
+
readonly kind: 'exact';
|
|
34
|
+
} & TypescriptParsedProject) | TypescriptFastParsedProject;
|
|
35
|
+
/**
|
|
36
|
+
* Parse the project for the requested resolution tier. `fast` skips the
|
|
37
|
+
* Program + checker entirely (see {@link parseProjectFast}); `exact`
|
|
38
|
+
* builds the Program and lets the resolve stage construct the checker only
|
|
39
|
+
* when semantic edge resolution actually needs it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseProject(input: ParseInput): ParseOutput<TsParsed>;
|
|
42
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAoB,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAc,MAAM,oBAAoB,CAAC;AAE9E,gFAAgF;AAChF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAChB,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,uBAAuB,CAAC,GACtD,2BAA2B,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC,QAAQ,CAAC,CAKrE"}
|
package/dist/parse.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript parseProject implementation.
|
|
3
|
+
*
|
|
4
|
+
* Lifts `ts.createProgram` + the eager `getTypeChecker()` call out of
|
|
5
|
+
* the orchestrator (where they used to live in cli/orchestrate.ts:
|
|
6
|
+
* buildAndResolveCatalog) into the adapter, so the orchestrator no
|
|
7
|
+
* longer imports `'typescript'` after PR 3 of plan
|
|
8
|
+
* docs/plans/10-graph-language-pluggability.md.
|
|
9
|
+
*
|
|
10
|
+
* Per contract invariant I-7 (parseProject is total over `files`):
|
|
11
|
+
* every file in `input.files` either parses successfully or surfaces
|
|
12
|
+
* in `parseErrors`. The TypeScript compiler reports parse problems
|
|
13
|
+
* via diagnostic streams rather than throwing; we surface those that
|
|
14
|
+
* the program emits at the file level into a structured ParseError
|
|
15
|
+
* list.
|
|
16
|
+
*/
|
|
17
|
+
import { relative } from 'node:path';
|
|
18
|
+
import ts from 'typescript';
|
|
19
|
+
import { parseProjectFast } from './parse-fast.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parse the project for the requested resolution tier. `fast` skips the
|
|
22
|
+
* Program + checker entirely (see {@link parseProjectFast}); `exact`
|
|
23
|
+
* builds the Program and lets the resolve stage construct the checker only
|
|
24
|
+
* when semantic edge resolution actually needs it.
|
|
25
|
+
*/
|
|
26
|
+
export function parseProject(input) {
|
|
27
|
+
if (input.resolutionMode === 'fast') {
|
|
28
|
+
return parseProjectFast(input);
|
|
29
|
+
}
|
|
30
|
+
return parseProjectExact(input);
|
|
31
|
+
}
|
|
32
|
+
/** Constructs a tsc Program for the TS source files in the input, returning parse errors if any. */
|
|
33
|
+
function parseProjectExact(input) {
|
|
34
|
+
// Anchor the program to its origin tsconfig when discovery provided
|
|
35
|
+
// one. tsc reads `options.configFilePath` for project-reference and
|
|
36
|
+
// rootDir resolution; synthetic-partition discovery (flat monorepos)
|
|
37
|
+
// depends on each partition's program knowing its own tsconfig.
|
|
38
|
+
const compilerOptions = {
|
|
39
|
+
...(input.compilerOptions ?? {}),
|
|
40
|
+
...(input.configPathAbs ? { configFilePath: input.configPathAbs } : {}),
|
|
41
|
+
};
|
|
42
|
+
const program = ts.createProgram({
|
|
43
|
+
rootNames: [...input.files],
|
|
44
|
+
options: compilerOptions,
|
|
45
|
+
});
|
|
46
|
+
// Force the binder. getTypeChecker() binds every source file, which
|
|
47
|
+
// populates BOTH the AST parent pointers the structural walk reads (a
|
|
48
|
+
// Program parses with setParentNodes:false, so node.parent is otherwise
|
|
49
|
+
// undefined) AND the symbol tables the exact resolver needs. Deferring it
|
|
50
|
+
// saves nothing in exact mode: resolveEdgesFromRecords (edges.ts) calls
|
|
51
|
+
// getTypeChecker() unconditionally, so the bind happens either way — and
|
|
52
|
+
// the cached second call is a no-op. Forcing it here is what makes the
|
|
53
|
+
// walk's parent chains valid. (Fast mode skips all of this and substitutes
|
|
54
|
+
// createSourceFile(setParentNodes:true); see parse-fast.ts.)
|
|
55
|
+
program.getTypeChecker();
|
|
56
|
+
const parseErrors = [];
|
|
57
|
+
/* v8 ignore start */
|
|
58
|
+
const seenPaths = new Set();
|
|
59
|
+
for (const sf of program.getSourceFiles()) {
|
|
60
|
+
const diagnostics = program.getSyntacticDiagnostics(sf);
|
|
61
|
+
if (diagnostics.length === 0)
|
|
62
|
+
continue;
|
|
63
|
+
const filePath = relative(input.projectDirAbs, sf.fileName);
|
|
64
|
+
if (seenPaths.has(filePath))
|
|
65
|
+
continue;
|
|
66
|
+
seenPaths.add(filePath);
|
|
67
|
+
for (const diag of diagnostics) {
|
|
68
|
+
const message = ts.flattenDiagnosticMessageText(diag.messageText, '\n');
|
|
69
|
+
parseErrors.push({ filePath, message });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/* v8 ignore stop */
|
|
73
|
+
return { project: { kind: 'exact', program }, parseErrors };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAoC,MAAM,iBAAiB,CAAC;AAqBrF;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,IAAI,KAAK,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;QACpC,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,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IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YACxE,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,oBAAoB;IAEpB,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if `filePathProjectRel` is a TypeScript / JS test
|
|
3
|
+
* file (or test fixture) by path convention. Path is project-relative with `/`
|
|
4
|
+
* separators (the same shape `Catalog.functions[*].filePath` carries).
|
|
5
|
+
*/
|
|
6
|
+
export declare function isTypescriptTestFile(filePathProjectRel: string): boolean;
|
|
7
|
+
//# sourceMappingURL=test-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-file.d.ts","sourceRoot":"","sources":["../src/test-file.ts"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAMxE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical TypeScript test-file predicate.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for "is this project-relative path a test
|
|
5
|
+
* file?" within the TypeScript adapter. Callers used to roll their
|
|
6
|
+
* own copies:
|
|
7
|
+
*
|
|
8
|
+
* - walk.ts (file-walker) — stamped `inTestFile` on every occurrence
|
|
9
|
+
* during stage 1+2 descent.
|
|
10
|
+
* - index.ts (RuleHints.isTestFile) — the canonical answer wired
|
|
11
|
+
* into rule evaluation, with broader recall.
|
|
12
|
+
*
|
|
13
|
+
* The 2026-05-23 audit (M-1) flagged the divergence — at the time a
|
|
14
|
+
* third copy lived in the now-removed `inventory.ts` — three
|
|
15
|
+
* predicates at three layer altitudes drifting silently. This module
|
|
16
|
+
* is the one place to extend the rule.
|
|
17
|
+
*
|
|
18
|
+
* Anchored patterns instead of one alternation; avoids catastrophic
|
|
19
|
+
* backtracking on pathological inputs.
|
|
20
|
+
*
|
|
21
|
+
* `__fixtures__/` is included: it is test scaffolding by convention (synthetic
|
|
22
|
+
* inputs for tests, e.g. the orchestrator's `__fixtures__/multi-pkg/` mini-repo),
|
|
23
|
+
* not production code. Without this, reachability/size/cycle rules treat fixture
|
|
24
|
+
* functions as real code and over-trigger (e.g. a fixture helper with no caller
|
|
25
|
+
* reads as a `graph:orphan-subtree`). A `__fixtures__/` dir nested under
|
|
26
|
+
* `__tests__/` is already covered by the first pattern; this also catches the
|
|
27
|
+
* ones that sit beside the code under test.
|
|
28
|
+
*/
|
|
29
|
+
const TEST_TESTS_DIR_RE = /(?:^|\/)__tests__\//;
|
|
30
|
+
const TEST_FIXTURES_DIR_RE = /(?:^|\/)__fixtures__\//;
|
|
31
|
+
const TEST_FILE_SUFFIX_RE = /\.test\.(?:ts|tsx|js|jsx)$|_test\.(?:ts|tsx|js|jsx)$/;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if `filePathProjectRel` is a TypeScript / JS test
|
|
34
|
+
* file (or test fixture) by path convention. Path is project-relative with `/`
|
|
35
|
+
* separators (the same shape `Catalog.functions[*].filePath` carries).
|
|
36
|
+
*/
|
|
37
|
+
export function isTypescriptTestFile(filePathProjectRel) {
|
|
38
|
+
return (TEST_TESTS_DIR_RE.test(filePathProjectRel) ||
|
|
39
|
+
TEST_FIXTURES_DIR_RE.test(filePathProjectRel) ||
|
|
40
|
+
TEST_FILE_SUFFIX_RE.test(filePathProjectRel));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=test-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-file.js","sourceRoot":"","sources":["../src/test-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAChD,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AACtD,MAAM,mBAAmB,GAAG,sDAAsD,CAAC;AAEnF;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,kBAA0B;IAC7D,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC;QAC1C,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,CAAC;QAC7C,mBAAmB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAC7C,CAAC;AACJ,CAAC"}
|
package/dist/walk.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage 1+2 unified walk — Phase 4 of
|
|
3
|
+
* docs/plans/graph-performance-improvements.md.
|
|
4
|
+
*
|
|
5
|
+
* Legacy pipeline walked every source file twice: once for Stage 1
|
|
6
|
+
* (emit FunctionOccurrence records) and once for Stage 2 (locate +
|
|
7
|
+
* resolve call sites). The two walks descend in identical order and
|
|
8
|
+
* the only data flowing between them is each function-shape's
|
|
9
|
+
* bodyHash — which Stage 1 already computes. Stage 2 was *re-hashing*
|
|
10
|
+
* every function-shape to look it up in `fnByHash`.
|
|
11
|
+
*
|
|
12
|
+
* Phase 4 fuses both passes into one descent per file. The walker
|
|
13
|
+
* emits both:
|
|
14
|
+
* - `occurrences` — what Stage 1 emitted (function/method/arrow/etc.
|
|
15
|
+
* records, plus a synthesized module-init per file).
|
|
16
|
+
* - `callSites` — flat list of nodes that Stage 2's resolvers care
|
|
17
|
+
* about, paired with the bodyHash that owns them. Resolution
|
|
18
|
+
* happens *outside* the walk, against this flat list.
|
|
19
|
+
*
|
|
20
|
+
* The orchestrator (`cli/orchestrate.ts`) drives the pipeline
|
|
21
|
+
* end-to-end. `edges.ts` exposes `resolveEdgesFromRecords` as the
|
|
22
|
+
* Stage 2 entry point, consuming the `callSites` this walk emits.
|
|
23
|
+
*/
|
|
24
|
+
import ts from 'typescript';
|
|
25
|
+
import type { FunctionOccurrence, ParseError } from '@opensip-cli/graph';
|
|
26
|
+
/**
|
|
27
|
+
* A node the unified walk identified as a candidate Stage 2 resolver
|
|
28
|
+
* target — pre-paired with the bodyHash of its enclosing function-shape
|
|
29
|
+
* occurrence so the resolver dispatcher doesn't need to re-walk the
|
|
30
|
+
* AST or re-hash to find ownership.
|
|
31
|
+
*/
|
|
32
|
+
export interface CallSiteRecord {
|
|
33
|
+
readonly node: ts.Node;
|
|
34
|
+
readonly sourceFile: ts.SourceFile;
|
|
35
|
+
/**
|
|
36
|
+
* The function occurrence that owns this site, identified by its
|
|
37
|
+
* `bodyHash`. Top-level (module-init) sites carry the synthesized
|
|
38
|
+
* module-init occurrence's hash.
|
|
39
|
+
*/
|
|
40
|
+
readonly ownerHash: string;
|
|
41
|
+
/**
|
|
42
|
+
* 'call' for resolver dispatch (call/new/jsx/identifier-ref/
|
|
43
|
+
* shorthand). 'creation' for parent → nested-callable creation
|
|
44
|
+
* edges (arrows, function-expressions, methods, accessors,
|
|
45
|
+
* constructors); the resolver pass emits a static high-confidence
|
|
46
|
+
* edge for these without consulting any resolver.
|
|
47
|
+
*/
|
|
48
|
+
readonly kind: 'call' | 'creation';
|
|
49
|
+
/**
|
|
50
|
+
* For 'creation' kind, the bodyHash of the nested callable.
|
|
51
|
+
*/
|
|
52
|
+
readonly childHash?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One module-level import site discovered by the walker. Resolved to
|
|
56
|
+
* a target module-init bodyHash by the resolver (Phase 4 of opensip's
|
|
57
|
+
* substrate consolidation — DEC-498).
|
|
58
|
+
*
|
|
59
|
+
* Covers `ImportDeclaration` and `ImportEqualsDeclaration` with a
|
|
60
|
+
* string moduleSpecifier. Re-exports (`ExportDeclaration` with
|
|
61
|
+
* `moduleSpecifier`) and dynamic imports (`import('…')` expressions)
|
|
62
|
+
* are out of scope at v1 — they can be added in a follow-up if
|
|
63
|
+
* dispatch grouping shows they matter.
|
|
64
|
+
*/
|
|
65
|
+
export interface DependencySiteRecord {
|
|
66
|
+
readonly node: ts.Node;
|
|
67
|
+
readonly sourceFile: ts.SourceFile;
|
|
68
|
+
/** bodyHash of the file's synthesized module-init occurrence. */
|
|
69
|
+
readonly ownerHash: string;
|
|
70
|
+
/** Raw import specifier — `'./foo'`, `'@opensip/core'`, etc. */
|
|
71
|
+
readonly specifier: string;
|
|
72
|
+
/** 1-based line of the import statement. */
|
|
73
|
+
readonly line: number;
|
|
74
|
+
/** 0-based column. */
|
|
75
|
+
readonly column: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One re-export the file declares, normalized to the data the engine's
|
|
79
|
+
* export index needs to make a re-exported name resolvable under the
|
|
80
|
+
* RE-EXPORTING package. Two TS forms produce these:
|
|
81
|
+
*
|
|
82
|
+
* 1. `export { a, b as c } from './y' | '@scope/pkg'` — an
|
|
83
|
+
* `ExportDeclaration` WITH a `moduleSpecifier`.
|
|
84
|
+
* 2. `export { a, b }` (NO `from`) where `a`/`b` are bindings IMPORTED at
|
|
85
|
+
* the top of the file — TS's import-then-re-export idiom (e.g.
|
|
86
|
+
* `import { childrenOf } from '@opensip-cli/tree-sitter'; export
|
|
87
|
+
* { childrenOf }`). Correlated against the file's named imports.
|
|
88
|
+
*
|
|
89
|
+
* A plain `export { localDef }` of a name DEFINED in this file is NOT a
|
|
90
|
+
* re-export — it is already an `'exported'` occurrence in the catalog — so it
|
|
91
|
+
* produces no record.
|
|
92
|
+
*/
|
|
93
|
+
export interface ReExportRecord {
|
|
94
|
+
/** Re-exporting file, project-relative POSIX (→ `packageOf` gives the group). */
|
|
95
|
+
readonly fromFile: string;
|
|
96
|
+
/** The name as exposed BY this module. `'*'` for `export * from`. */
|
|
97
|
+
readonly exportedName: string;
|
|
98
|
+
/** The name in the SOURCE module (== `exportedName` unless aliased via
|
|
99
|
+
* `export { x as y }`; `'*'` for star). */
|
|
100
|
+
readonly sourceName: string;
|
|
101
|
+
/** The source module specifier — relative (`'./x'`) or workspace (`'@scope/pkg'`). */
|
|
102
|
+
readonly specifier: string;
|
|
103
|
+
}
|
|
104
|
+
export interface WalkInput {
|
|
105
|
+
/**
|
|
106
|
+
* The project's source files to walk. Supplied by the adapter from
|
|
107
|
+
* either tier: exact mode passes `program.getSourceFiles()`; fast mode
|
|
108
|
+
* passes the standalone source-file map's values. The walk is purely
|
|
109
|
+
* structural — it needs `ts.SourceFile`s with parent pointers (which
|
|
110
|
+
* both tiers provide) and nothing from the type checker — so it is
|
|
111
|
+
* mode-agnostic and never sees a `ts.Program`.
|
|
112
|
+
*/
|
|
113
|
+
readonly sourceFiles: Iterable<ts.SourceFile>;
|
|
114
|
+
readonly files: readonly string[];
|
|
115
|
+
readonly projectDirAbs: string;
|
|
116
|
+
}
|
|
117
|
+
export interface WalkOutput {
|
|
118
|
+
readonly functions: Record<string, FunctionOccurrence[]>;
|
|
119
|
+
readonly callSites: readonly CallSiteRecord[];
|
|
120
|
+
readonly dependencySites: readonly DependencySiteRecord[];
|
|
121
|
+
readonly reExports: readonly ReExportRecord[];
|
|
122
|
+
readonly parseErrors: readonly ParseError[];
|
|
123
|
+
}
|
|
124
|
+
export declare function walkProgram(input: WalkInput): WalkOutput;
|
|
125
|
+
//# sourceMappingURL=walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../src/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAE,MAAM,YAAY,CAAC;AAa5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CA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