@suss/adapter-typescript 0.5.5 → 0.5.7
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/dist/index.cjs +25 -50
- package/dist/index.js +25 -50
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1905,58 +1905,27 @@ function addImportersOfMatches(fileImports, matched, options) {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
function internalSpecifierResolver(files, options) {
|
|
1907
1907
|
const fileSet = new Set(files);
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
}
|
|
1914
|
-
for (const stem of stems) {
|
|
1915
|
-
for (const candidate of [
|
|
1916
|
-
stem,
|
|
1917
|
-
`${stem}.ts`,
|
|
1918
|
-
`${stem}.tsx`,
|
|
1919
|
-
import_node_path.default.join(stem, "index.ts"),
|
|
1920
|
-
import_node_path.default.join(stem, "index.tsx")
|
|
1921
|
-
]) {
|
|
1922
|
-
if (fileSet.has(candidate)) {
|
|
1923
|
-
return candidate;
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
return null;
|
|
1928
|
-
};
|
|
1929
|
-
const pathsBase = options.baseUrl ?? (typeof options.pathsBasePath === "string" ? options.pathsBasePath : "");
|
|
1930
|
-
const aliasTargets = (spec) => {
|
|
1931
|
-
const out = [];
|
|
1932
|
-
for (const [pattern, targets] of Object.entries(options.paths ?? {})) {
|
|
1933
|
-
const star = pattern.indexOf("*");
|
|
1934
|
-
if (star === -1) {
|
|
1935
|
-
if (spec === pattern) {
|
|
1936
|
-
out.push(...targets);
|
|
1937
|
-
}
|
|
1938
|
-
continue;
|
|
1939
|
-
}
|
|
1940
|
-
const prefix = pattern.slice(0, star);
|
|
1941
|
-
const suffix = pattern.slice(star + 1);
|
|
1942
|
-
if (spec.length >= prefix.length + suffix.length && spec.startsWith(prefix) && spec.endsWith(suffix)) {
|
|
1943
|
-
const filler = spec.slice(prefix.length, spec.length - suffix.length);
|
|
1944
|
-
out.push(...targets.map((t) => t.replace("*", filler)));
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
return out.map((t) => import_node_path.default.resolve(pathsBase, t));
|
|
1948
|
-
};
|
|
1908
|
+
const cache = import_ts_morph9.ts.createModuleResolutionCache(
|
|
1909
|
+
import_ts_morph9.ts.sys.getCurrentDirectory(),
|
|
1910
|
+
(name) => name,
|
|
1911
|
+
options
|
|
1912
|
+
);
|
|
1949
1913
|
return (fromFile, spec) => {
|
|
1950
|
-
|
|
1951
|
-
|
|
1914
|
+
const resolved = import_ts_morph9.ts.resolveModuleName(
|
|
1915
|
+
spec,
|
|
1916
|
+
fromFile,
|
|
1917
|
+
options,
|
|
1918
|
+
import_ts_morph9.ts.sys,
|
|
1919
|
+
cache
|
|
1920
|
+
).resolvedModule?.resolvedFileName;
|
|
1921
|
+
if (resolved === void 0) {
|
|
1922
|
+
return null;
|
|
1952
1923
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
if (hit !== null) {
|
|
1956
|
-
return hit;
|
|
1957
|
-
}
|
|
1924
|
+
if (fileSet.has(resolved)) {
|
|
1925
|
+
return resolved;
|
|
1958
1926
|
}
|
|
1959
|
-
|
|
1927
|
+
const real = import_ts_morph9.ts.sys.realpath?.(resolved) ?? resolved;
|
|
1928
|
+
return fileSet.has(real) ? real : null;
|
|
1960
1929
|
};
|
|
1961
1930
|
}
|
|
1962
1931
|
function collectAllGates(packs) {
|
|
@@ -2436,12 +2405,13 @@ function dispatchAccessRecognizers(root, recognizers, isStop) {
|
|
|
2436
2405
|
}
|
|
2437
2406
|
const out = [];
|
|
2438
2407
|
const sourceFile = root.getSourceFile();
|
|
2408
|
+
const seenEffects = /* @__PURE__ */ new Set();
|
|
2439
2409
|
root.forEachDescendant((node, traversal) => {
|
|
2440
2410
|
if (isStop(node)) {
|
|
2441
2411
|
traversal.skip();
|
|
2442
2412
|
return;
|
|
2443
2413
|
}
|
|
2444
|
-
if (!import_ts_morph12.Node.isPropertyAccessExpression(node)) {
|
|
2414
|
+
if (!import_ts_morph12.Node.isPropertyAccessExpression(node) && !import_ts_morph12.Node.isCallExpression(node)) {
|
|
2445
2415
|
return;
|
|
2446
2416
|
}
|
|
2447
2417
|
const ctx = {
|
|
@@ -2466,6 +2436,11 @@ function dispatchAccessRecognizers(root, recognizers, isStop) {
|
|
|
2466
2436
|
continue;
|
|
2467
2437
|
}
|
|
2468
2438
|
for (const eff of emitted) {
|
|
2439
|
+
const key = `${line}:${JSON.stringify(eff)}`;
|
|
2440
|
+
if (seenEffects.has(key)) {
|
|
2441
|
+
continue;
|
|
2442
|
+
}
|
|
2443
|
+
seenEffects.add(key);
|
|
2469
2444
|
out.push({ effect: eff, line });
|
|
2470
2445
|
}
|
|
2471
2446
|
}
|
package/dist/index.js
CHANGED
|
@@ -1875,58 +1875,27 @@ function addImportersOfMatches(fileImports, matched, options) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
function internalSpecifierResolver(files, options) {
|
|
1877
1877
|
const fileSet = new Set(files);
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
}
|
|
1884
|
-
for (const stem of stems) {
|
|
1885
|
-
for (const candidate of [
|
|
1886
|
-
stem,
|
|
1887
|
-
`${stem}.ts`,
|
|
1888
|
-
`${stem}.tsx`,
|
|
1889
|
-
path.join(stem, "index.ts"),
|
|
1890
|
-
path.join(stem, "index.tsx")
|
|
1891
|
-
]) {
|
|
1892
|
-
if (fileSet.has(candidate)) {
|
|
1893
|
-
return candidate;
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
return null;
|
|
1898
|
-
};
|
|
1899
|
-
const pathsBase = options.baseUrl ?? (typeof options.pathsBasePath === "string" ? options.pathsBasePath : "");
|
|
1900
|
-
const aliasTargets = (spec) => {
|
|
1901
|
-
const out = [];
|
|
1902
|
-
for (const [pattern, targets] of Object.entries(options.paths ?? {})) {
|
|
1903
|
-
const star = pattern.indexOf("*");
|
|
1904
|
-
if (star === -1) {
|
|
1905
|
-
if (spec === pattern) {
|
|
1906
|
-
out.push(...targets);
|
|
1907
|
-
}
|
|
1908
|
-
continue;
|
|
1909
|
-
}
|
|
1910
|
-
const prefix = pattern.slice(0, star);
|
|
1911
|
-
const suffix = pattern.slice(star + 1);
|
|
1912
|
-
if (spec.length >= prefix.length + suffix.length && spec.startsWith(prefix) && spec.endsWith(suffix)) {
|
|
1913
|
-
const filler = spec.slice(prefix.length, spec.length - suffix.length);
|
|
1914
|
-
out.push(...targets.map((t) => t.replace("*", filler)));
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
return out.map((t) => path.resolve(pathsBase, t));
|
|
1918
|
-
};
|
|
1878
|
+
const cache = ts.createModuleResolutionCache(
|
|
1879
|
+
ts.sys.getCurrentDirectory(),
|
|
1880
|
+
(name) => name,
|
|
1881
|
+
options
|
|
1882
|
+
);
|
|
1919
1883
|
return (fromFile, spec) => {
|
|
1920
|
-
|
|
1921
|
-
|
|
1884
|
+
const resolved = ts.resolveModuleName(
|
|
1885
|
+
spec,
|
|
1886
|
+
fromFile,
|
|
1887
|
+
options,
|
|
1888
|
+
ts.sys,
|
|
1889
|
+
cache
|
|
1890
|
+
).resolvedModule?.resolvedFileName;
|
|
1891
|
+
if (resolved === void 0) {
|
|
1892
|
+
return null;
|
|
1922
1893
|
}
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
if (hit !== null) {
|
|
1926
|
-
return hit;
|
|
1927
|
-
}
|
|
1894
|
+
if (fileSet.has(resolved)) {
|
|
1895
|
+
return resolved;
|
|
1928
1896
|
}
|
|
1929
|
-
|
|
1897
|
+
const real = ts.sys.realpath?.(resolved) ?? resolved;
|
|
1898
|
+
return fileSet.has(real) ? real : null;
|
|
1930
1899
|
};
|
|
1931
1900
|
}
|
|
1932
1901
|
function collectAllGates(packs) {
|
|
@@ -2406,12 +2375,13 @@ function dispatchAccessRecognizers(root, recognizers, isStop) {
|
|
|
2406
2375
|
}
|
|
2407
2376
|
const out = [];
|
|
2408
2377
|
const sourceFile = root.getSourceFile();
|
|
2378
|
+
const seenEffects = /* @__PURE__ */ new Set();
|
|
2409
2379
|
root.forEachDescendant((node, traversal) => {
|
|
2410
2380
|
if (isStop(node)) {
|
|
2411
2381
|
traversal.skip();
|
|
2412
2382
|
return;
|
|
2413
2383
|
}
|
|
2414
|
-
if (!Node11.isPropertyAccessExpression(node)) {
|
|
2384
|
+
if (!Node11.isPropertyAccessExpression(node) && !Node11.isCallExpression(node)) {
|
|
2415
2385
|
return;
|
|
2416
2386
|
}
|
|
2417
2387
|
const ctx = {
|
|
@@ -2436,6 +2406,11 @@ function dispatchAccessRecognizers(root, recognizers, isStop) {
|
|
|
2436
2406
|
continue;
|
|
2437
2407
|
}
|
|
2438
2408
|
for (const eff of emitted) {
|
|
2409
|
+
const key = `${line}:${JSON.stringify(eff)}`;
|
|
2410
|
+
if (seenEffects.has(key)) {
|
|
2411
|
+
continue;
|
|
2412
|
+
}
|
|
2413
|
+
seenEffects.add(key);
|
|
2439
2414
|
out.push({ effect: eff, line });
|
|
2440
2415
|
}
|
|
2441
2416
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-typescript",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript adapter for suss — walks source files with ts-morph and emits raw extractions for the suss pipeline.",
|
|
6
6
|
"keywords": [
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"typecheck": "tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@suss/behavioral-ir": "0.5.
|
|
50
|
-
"@suss/datalog": "0.5.
|
|
51
|
-
"@suss/extractor": "0.5.
|
|
52
|
-
"@suss/resolution": "0.5.
|
|
49
|
+
"@suss/behavioral-ir": "0.5.7",
|
|
50
|
+
"@suss/datalog": "0.5.7",
|
|
51
|
+
"@suss/extractor": "0.5.7",
|
|
52
|
+
"@suss/resolution": "0.5.7",
|
|
53
53
|
"graphql": "^16.8.0",
|
|
54
54
|
"picomatch": "^4.0.4",
|
|
55
55
|
"ts-morph": "^23.0.0"
|