type-registry-effect 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/821.js +628 -0
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/index.d.ts +1754 -0
- package/index.js +173 -0
- package/node.d.ts +890 -0
- package/node.js +26 -0
- package/package.json +67 -0
- package/rslib-runtime.js +37 -0
- package/tsdoc-metadata.json +11 -0
package/node.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as __rspack_external_typescript from "typescript";
|
|
2
|
+
import { NodeFileSystem, NodeHttpClient } from "@effect/platform-node";
|
|
3
|
+
import { createDefaultMapFromNodeModules, createFSBackedSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
|
|
4
|
+
import { Layer, hasCached as TypeRegistry_hasCached, TypeRegistryLive, resolveVersion as TypeRegistry_resolveVersion, fetchAndCache as TypeRegistry_fetchAndCache, getVFS as TypeRegistry_getVFS, Effect } from "./821.js";
|
|
5
|
+
const NodeLayer = TypeRegistryLive.pipe(Layer.provide(NodeFileSystem.layer), Layer.provide(NodeHttpClient.layerUndici));
|
|
6
|
+
const runWithNodeLayer = (effect)=>Effect.runPromise(Effect.provide(effect, NodeLayer));
|
|
7
|
+
const hasCached = (pkg)=>runWithNodeLayer(TypeRegistry_hasCached(pkg));
|
|
8
|
+
const fetchAndCache = (pkg, options)=>runWithNodeLayer(TypeRegistry_fetchAndCache(pkg, options));
|
|
9
|
+
const getVFS = (packages, options)=>runWithNodeLayer(TypeRegistry_getVFS(packages, options));
|
|
10
|
+
const resolveVersion = (name, ref)=>runWithNodeLayer(TypeRegistry_resolveVersion(name, ref));
|
|
11
|
+
const createTypeScriptCache = async (packages, compilerOptions)=>{
|
|
12
|
+
const vfs = await getVFS(packages, {
|
|
13
|
+
autoFetch: true
|
|
14
|
+
});
|
|
15
|
+
const libMap = createDefaultMapFromNodeModules(compilerOptions, __rspack_external_typescript);
|
|
16
|
+
for (const [path, content] of libMap)vfs.set(path, content);
|
|
17
|
+
const sys = createFSBackedSystem(vfs, process.cwd(), __rspack_external_typescript);
|
|
18
|
+
const rootFiles = Array.from(vfs.keys()).filter((path)=>path.endsWith(".d.ts") || path.endsWith(".d.mts") || path.endsWith(".d.cts"));
|
|
19
|
+
const tsEnv = createVirtualTypeScriptEnvironment(sys, rootFiles, __rspack_external_typescript, compilerOptions);
|
|
20
|
+
const cacheKey = JSON.stringify(compilerOptions);
|
|
21
|
+
const cache = new Map();
|
|
22
|
+
cache.set(cacheKey, tsEnv);
|
|
23
|
+
return cache;
|
|
24
|
+
};
|
|
25
|
+
export { CacheErrorBase, CacheService, NetworkErrorBase, PackageFetcher, PackageNotFoundErrorBase, PackageSpec, PackageSpecBase, ParseErrorBase, ResolutionErrorBase, ResolvedModuleBase, TimeoutErrorBase, TypeResolver } from "./821.js";
|
|
26
|
+
export { NodeLayer, createTypeScriptCache, fetchAndCache, getVFS, hasCached, resolveVersion };
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "type-registry-effect",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Fetch, cache, and resolve TypeScript type definitions from npm packages for use with Twoslash and documentation tooling. Built on Effect.",
|
|
6
|
+
"homepage": "https://github.com/spencerbeggs/type-registry-effect#readme",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/spencerbeggs/type-registry-effect/issues"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/spencerbeggs/type-registry-effect.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "C. Spencer Beggs",
|
|
17
|
+
"email": "spencer@beggs.codes",
|
|
18
|
+
"url": "https://spencerbeg.gs"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"import": "./index.js"
|
|
25
|
+
},
|
|
26
|
+
"./node": {
|
|
27
|
+
"types": "./node.d.ts",
|
|
28
|
+
"import": "./node.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"semver-effect": "^0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@effect/platform": "^0.94.1",
|
|
36
|
+
"@effect/platform-node": "^0.104.0",
|
|
37
|
+
"@typescript/vfs": "^1.6.4",
|
|
38
|
+
"effect": "^3.19.14",
|
|
39
|
+
"typescript": "^5.7.3"
|
|
40
|
+
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"@effect/platform-node": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"@typescript/vfs": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"typescript": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"!tsconfig.json",
|
|
54
|
+
"!tsdoc.json",
|
|
55
|
+
"!type-registry-effect.api.json",
|
|
56
|
+
"821.js",
|
|
57
|
+
"LICENSE",
|
|
58
|
+
"README.md",
|
|
59
|
+
"index.d.ts",
|
|
60
|
+
"index.js",
|
|
61
|
+
"node.d.ts",
|
|
62
|
+
"node.js",
|
|
63
|
+
"package.json",
|
|
64
|
+
"rslib-runtime.js",
|
|
65
|
+
"tsdoc-metadata.json"
|
|
66
|
+
]
|
|
67
|
+
}
|
package/rslib-runtime.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __webpack_module_cache__ = {};
|
|
2
|
+
function __webpack_require__(moduleId) {
|
|
3
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
4
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
5
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
6
|
+
exports: {}
|
|
7
|
+
};
|
|
8
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
9
|
+
return module.exports;
|
|
10
|
+
}
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.add = function(modules) {
|
|
13
|
+
Object.assign(__webpack_require__.m, modules);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
18
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: definition[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
export { __webpack_require__ };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.57.7"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|