@pulse-compute/wasm-contracts 0.0.0 → 1.0.0-beta.2
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/README.md +35 -2
- package/package.json +124 -6
- package/src/assets/contracts.js +296 -0
- package/src/config/provider-resolution.js +54 -0
- package/src/config/runtime-provider-kv.js +73 -0
- package/src/config/symbolic-refs.js +192 -0
- package/src/crypto/contracts.js +647 -0
- package/src/definitions/config-schema.js +30 -0
- package/src/definitions/handler-roles.js +66 -0
- package/src/definitions/path-grammar.js +11 -0
- package/src/definitions/router-api.js +149 -0
- package/src/diagnostics/codes.js +42 -0
- package/src/diagnostics/reporter.js +20 -0
- package/src/diagnostics.js +139 -0
- package/src/dispatch-table.js +23 -0
- package/src/entities/catalog.d.ts +7 -0
- package/src/entities/catalog.js +87 -0
- package/src/entities/contracts.d.ts +95 -0
- package/src/entities/contracts.js +122 -0
- package/src/entities/json-rpc.d.ts +27 -0
- package/src/entities/json-rpc.js +69 -0
- package/src/entities/runtime.d.ts +67 -0
- package/src/entities/runtime.js +288 -0
- package/src/events/contracts.js +456 -0
- package/src/execution-plan.js +42 -0
- package/src/grip/contracts.js +106 -0
- package/src/handler/backend-json-request-body.js +58 -0
- package/src/handler/beta-lifecycle-golden.js +97 -0
- package/src/handler/canonical-native-plan.js +143 -0
- package/src/handler/canonical-native-runtime.js +168 -0
- package/src/handler/canonical-runtime.js +13 -0
- package/src/handler/context.js +131 -0
- package/src/handler/ctx-contract.js +71 -0
- package/src/handler/doctor-readiness-aggregator.js +67 -0
- package/src/handler/effects.js +446 -0
- package/src/handler/io-lifecycle.js +134 -0
- package/src/handler/lifecycle-authoring-alignment.js +56 -0
- package/src/handler/lifecycle-readiness-aggregate.js +93 -0
- package/src/handler/reference-node-lifecycle-golden.js +73 -0
- package/src/handler/request-json-body.js +147 -0
- package/src/handler/runtime-api.js +471 -0
- package/src/handler/schema-decode-result.js +135 -0
- package/src/handler/schema-response-codec.js +141 -0
- package/src/handler/surface-contract.js +601 -0
- package/src/handler/types-contract.js +51 -0
- package/src/handler-table.js +28 -0
- package/src/host/backend-capabilities.js +24 -0
- package/src/host/capabilities.js +273 -0
- package/src/host/channel-broadcaster.js +60 -0
- package/src/host/json-body.js +80 -0
- package/src/host/request-result-headers.js +38 -0
- package/src/host/streaming-passthrough.js +90 -0
- package/src/host/wasm-host-abi.js +154 -0
- package/src/index.js +75 -0
- package/src/jwt/contracts.js +427 -0
- package/src/library/api-surface.js +99 -0
- package/src/library/contracts.js +273 -0
- package/src/library/manifest.js +317 -0
- package/src/library/second-package-owned-lowering.js +39 -0
- package/src/library/sidecars.js +147 -0
- package/src/logging.js +89 -0
- package/src/package/package-contract.js +975 -0
- package/src/package/package-contract.schema.json +303 -0
- package/src/package/runtime-pulse-live.js +100 -0
- package/src/path-table.js +12 -0
- package/src/path.js +275 -0
- package/src/project/config-factory.js +48 -0
- package/src/project/config-plan.js +409 -0
- package/src/project/config-runtime.js +46 -0
- package/src/project/javascript-application.js +212 -0
- package/src/project/javascript-core-capabilities.js +44 -0
- package/src/project/native-optimization.js +9 -0
- package/src/project/package-ownership.js +242 -0
- package/src/project/package-product-projection.js +171 -0
- package/src/project/reachable-graph-identity.js +219 -0
- package/src/project/reachable-graph-projections.js +279 -0
- package/src/project/reachable-graph-resolver.js +303 -0
- package/src/project/reachable-graph-v2.js +430 -0
- package/src/project/reachable-graph-v2.schema.json +285 -0
- package/src/project/reachable-graph.js +199 -0
- package/src/project/reachable-graph.schema.json +222 -0
- package/src/project/target-support-evidence.js +559 -0
- package/src/provider/canonical-provider.js +239 -0
- package/src/provider/final-wasm-policy.js +87 -0
- package/src/provider/toolchain.js +771 -0
- package/src/route-plan.js +43 -0
- package/src/s3/contracts.js +12 -0
- package/src/schema-json/compile.js +63 -0
- package/src/schema-json/contracts.js +10 -0
- package/src/schema-json/generic-parser.js +62 -0
- package/src/schema-json/registry.js +359 -0
- package/src/schema-json/semantic-trace.js +241 -0
- package/src/schema-json/v1.js +65 -0
- package/src/schema-json/v2.js +110 -0
- package/src/sha256.js +104 -0
- package/src/spine.js +381 -0
- package/src/stable-id.js +142 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { stableStringify, sha256Hex } = require('../stable-id.js');
|
|
5
|
+
|
|
6
|
+
const MODULE_RESOLVER_CONTRACT_VERSION = 'pulse.module-resolver.v1';
|
|
7
|
+
const MODULE_RESOLVER_INPUT_VERSION = 'pulse.module-resolver-input.v1';
|
|
8
|
+
const RESOLUTION_KINDS = Object.freeze([
|
|
9
|
+
'project-relative',
|
|
10
|
+
'tsconfig-path',
|
|
11
|
+
'package-root',
|
|
12
|
+
'package-subpath',
|
|
13
|
+
'generated',
|
|
14
|
+
'external'
|
|
15
|
+
]);
|
|
16
|
+
const PROJECT_SOURCE_EXTENSIONS = Object.freeze([
|
|
17
|
+
'.ts',
|
|
18
|
+
'.tsx',
|
|
19
|
+
'.mts',
|
|
20
|
+
'.cts',
|
|
21
|
+
'.js',
|
|
22
|
+
'.jsx',
|
|
23
|
+
'.mjs',
|
|
24
|
+
'.cjs',
|
|
25
|
+
'.json'
|
|
26
|
+
]);
|
|
27
|
+
const TYPE_DECLARATION_EXTENSIONS = Object.freeze(['.d.ts', '.d.mts', '.d.cts']);
|
|
28
|
+
const RUNTIME_PACKAGE_CONDITIONS = Object.freeze(['pulse', 'import', 'default']);
|
|
29
|
+
const TYPE_PACKAGE_CONDITIONS = Object.freeze(['types', 'pulse', 'import', 'default']);
|
|
30
|
+
const PACKAGE_ROOT_FIELDS = Object.freeze(['module', 'main']);
|
|
31
|
+
const TYPE_ROOT_FIELDS = Object.freeze(['types', 'typings']);
|
|
32
|
+
const CANDIDATE_STEPS = Object.freeze([
|
|
33
|
+
'exact',
|
|
34
|
+
'typescript-extension-substitution',
|
|
35
|
+
'extension-append',
|
|
36
|
+
'directory-package-entry',
|
|
37
|
+
'directory-index'
|
|
38
|
+
]);
|
|
39
|
+
const TYPESCRIPT_EXTENSION_SUBSTITUTIONS = Object.freeze({
|
|
40
|
+
'.js': Object.freeze(['.ts', '.tsx', '.js']),
|
|
41
|
+
'.jsx': Object.freeze(['.tsx', '.jsx']),
|
|
42
|
+
'.mjs': Object.freeze(['.mts', '.mjs']),
|
|
43
|
+
'.cjs': Object.freeze(['.cts', '.cjs'])
|
|
44
|
+
});
|
|
45
|
+
const EXTERNAL_SCHEMES = Object.freeze(['node:', 'http:', 'https:', 'data:']);
|
|
46
|
+
|
|
47
|
+
function isPlainObject(value) {
|
|
48
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
49
|
+
const proto = Object.getPrototypeOf(value);
|
|
50
|
+
return proto === Object.prototype || proto === null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function assertKnownKeys(input, allowed, field) {
|
|
54
|
+
for (const key of Object.keys(input)) {
|
|
55
|
+
if (!allowed.has(key)) throw new TypeError(`${field} contains unsupported field ${key}.`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function assertString(value, field) {
|
|
60
|
+
if (typeof value !== 'string' || value.trim() === '') throw new TypeError(`${field} must be a non-empty string.`);
|
|
61
|
+
if (value.includes('\0')) throw new TypeError(`${field} must not contain NUL.`);
|
|
62
|
+
return value.trim();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function assertSha256(value, field, options = {}) {
|
|
66
|
+
if (value == null && options.nullable === true) return null;
|
|
67
|
+
const text = assertString(value, field);
|
|
68
|
+
if (!/^[0-9a-f]{64}$/.test(text)) throw new TypeError(`${field} must be a lowercase SHA-256 hex string.`);
|
|
69
|
+
return text;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function normalizePortablePath(value, field, options = {}) {
|
|
73
|
+
const text = assertString(value, field).replace(/\\/g, '/');
|
|
74
|
+
if (/^[a-zA-Z]:\//.test(text) || text.startsWith('/') || /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(text)) {
|
|
75
|
+
throw new TypeError(`${field} must be a portable workspace-relative path.`);
|
|
76
|
+
}
|
|
77
|
+
const normalized = path.posix.normalize(text);
|
|
78
|
+
if (normalized === '..' || normalized.startsWith('../')) throw new TypeError(`${field} must not escape the workspace.`);
|
|
79
|
+
if (normalized === '.') {
|
|
80
|
+
if (options.allowDot === true) return '.';
|
|
81
|
+
throw new TypeError(`${field} must identify a file or non-root path.`);
|
|
82
|
+
}
|
|
83
|
+
const withoutPrefix = normalized.startsWith('./') ? normalized.slice(2) : normalized;
|
|
84
|
+
if (!withoutPrefix || withoutPrefix.endsWith('/')) throw new TypeError(`${field} must be a normalized portable path.`);
|
|
85
|
+
return withoutPrefix;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function normalizeDirectoryPath(value, field) {
|
|
89
|
+
if (value == null || value === '' || value === '.') return '.';
|
|
90
|
+
return normalizePortablePath(value, field, { allowDot: true });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function normalizeModuleSpecifier(value, field = 'specifier') {
|
|
94
|
+
const specifier = assertString(value, field).replace(/\\/g, '/');
|
|
95
|
+
if (specifier.startsWith('/') || /^[a-zA-Z]:\//.test(specifier)) {
|
|
96
|
+
throw new TypeError(`${field} must not be an absolute filesystem path.`);
|
|
97
|
+
}
|
|
98
|
+
return specifier;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function wildcardCount(value) {
|
|
102
|
+
return (String(value).match(/\*/g) || []).length;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function normalizePathAlias(input, index) {
|
|
106
|
+
if (!isPlainObject(input)) throw new TypeError(`pathAliases[${index}] must be an object.`);
|
|
107
|
+
assertKnownKeys(input, new Set(['pattern', 'targets', 'wildcard', 'prefix', 'suffix']), `pathAliases[${index}]`);
|
|
108
|
+
const pattern = assertString(input.pattern, `pathAliases[${index}].pattern`).replace(/\\/g, '/');
|
|
109
|
+
if (pattern.startsWith('.') || pattern.startsWith('/') || /^[a-zA-Z]:\//.test(pattern)) {
|
|
110
|
+
throw new TypeError(`pathAliases[${index}].pattern must be a bare alias pattern.`);
|
|
111
|
+
}
|
|
112
|
+
const stars = wildcardCount(pattern);
|
|
113
|
+
if (stars > 1) throw new TypeError(`pathAliases[${index}].pattern may contain at most one wildcard.`);
|
|
114
|
+
if (!Array.isArray(input.targets) || input.targets.length === 0) {
|
|
115
|
+
throw new TypeError(`pathAliases[${index}].targets must be a non-empty array.`);
|
|
116
|
+
}
|
|
117
|
+
const targets = [];
|
|
118
|
+
for (let targetIndex = 0; targetIndex < input.targets.length; targetIndex += 1) {
|
|
119
|
+
const raw = assertString(input.targets[targetIndex], `pathAliases[${index}].targets[${targetIndex}]`).replace(/\\/g, '/');
|
|
120
|
+
const targetStars = wildcardCount(raw);
|
|
121
|
+
if (targetStars > 1) throw new TypeError(`pathAliases[${index}].targets[${targetIndex}] may contain at most one wildcard.`);
|
|
122
|
+
if ((stars === 1) !== (targetStars === 1)) {
|
|
123
|
+
throw new TypeError(`pathAliases[${index}] wildcard usage must match between pattern and targets.`);
|
|
124
|
+
}
|
|
125
|
+
targets.push(normalizePortablePath(raw.replace('*', '__PULSE_WILDCARD__'), `pathAliases[${index}].targets[${targetIndex}]`).replace('__PULSE_WILDCARD__', '*'));
|
|
126
|
+
}
|
|
127
|
+
const prefix = stars === 1 ? pattern.slice(0, pattern.indexOf('*')) : pattern;
|
|
128
|
+
const suffix = stars === 1 ? pattern.slice(pattern.indexOf('*') + 1) : '';
|
|
129
|
+
return Object.freeze({
|
|
130
|
+
pattern,
|
|
131
|
+
wildcard: stars === 1,
|
|
132
|
+
prefix,
|
|
133
|
+
suffix,
|
|
134
|
+
targets: Object.freeze(Array.from(new Set(targets)))
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function compareAliases(a, b) {
|
|
139
|
+
if (a.wildcard !== b.wildcard) return a.wildcard ? 1 : -1;
|
|
140
|
+
if (a.prefix.length !== b.prefix.length) return b.prefix.length - a.prefix.length;
|
|
141
|
+
if (a.suffix.length !== b.suffix.length) return b.suffix.length - a.suffix.length;
|
|
142
|
+
return a.pattern.localeCompare(b.pattern);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function defaultModuleResolverContract() {
|
|
146
|
+
return Object.freeze({
|
|
147
|
+
version: MODULE_RESOLVER_CONTRACT_VERSION,
|
|
148
|
+
inputVersion: MODULE_RESOLVER_INPUT_VERSION,
|
|
149
|
+
resolutionKinds: RESOLUTION_KINDS,
|
|
150
|
+
projectSourceExtensions: PROJECT_SOURCE_EXTENSIONS,
|
|
151
|
+
typeDeclarationExtensions: TYPE_DECLARATION_EXTENSIONS,
|
|
152
|
+
runtimePackageConditions: RUNTIME_PACKAGE_CONDITIONS,
|
|
153
|
+
typePackageConditions: TYPE_PACKAGE_CONDITIONS,
|
|
154
|
+
packageRootFields: PACKAGE_ROOT_FIELDS,
|
|
155
|
+
typeRootFields: TYPE_ROOT_FIELDS,
|
|
156
|
+
candidateSteps: CANDIDATE_STEPS,
|
|
157
|
+
typescriptExtensionSubstitutions: TYPESCRIPT_EXTENSION_SUBSTITUTIONS,
|
|
158
|
+
policies: Object.freeze({
|
|
159
|
+
staticEsmOnly: true,
|
|
160
|
+
exactSpecifierFirst: true,
|
|
161
|
+
deterministicCandidateOrder: true,
|
|
162
|
+
ambiguousSuccessfulCandidatesAreErrors: true,
|
|
163
|
+
packageExportsAreAuthoritativeWhenPresent: true,
|
|
164
|
+
unexportedDeepImportsAllowedWhenExportsPresent: false,
|
|
165
|
+
typeOnlyEdgesDoNotCreateRuntimeReachability: true,
|
|
166
|
+
tsconfigPathPatterns: 'exact-or-single-wildcard',
|
|
167
|
+
tsconfigPathPatternPrecedence: 'exact-then-longest-prefix-and-suffix',
|
|
168
|
+
supportedTsconfigResolutionInputs: Object.freeze(['baseUrl', 'paths']),
|
|
169
|
+
deferredTsconfigResolutionInputs: Object.freeze(['extends', 'rootDirs', 'moduleSuffixes', 'customConditions', 'plugins']),
|
|
170
|
+
symlinkPolicy: 'resolve-for-containment-preserve-logical-identity',
|
|
171
|
+
pathIdentity: 'workspace-relative-posix',
|
|
172
|
+
casePolicy: 'case-sensitive-manifest-reject-case-fold-collisions',
|
|
173
|
+
hostPlatformAffectsIdentity: false,
|
|
174
|
+
dynamicImportImplemented: false,
|
|
175
|
+
arbitraryRequireImplemented: false,
|
|
176
|
+
loaderHooksImplemented: false,
|
|
177
|
+
packageManagerPluginsImplemented: false
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function normalizeModuleResolverInput(input = {}) {
|
|
183
|
+
if (!isPlainObject(input)) throw new TypeError('Resolver input must be an object.');
|
|
184
|
+
assertKnownKeys(input, new Set(['version', 'resolverVersion', 'resolverHash', 'baseUrl', 'pathAliases', 'configFile', 'configContentHash']), 'Resolver input');
|
|
185
|
+
const aliases = Object.freeze([...(input.pathAliases || [])].map(normalizePathAlias).sort(compareAliases));
|
|
186
|
+
const patterns = new Set();
|
|
187
|
+
for (const alias of aliases) {
|
|
188
|
+
if (patterns.has(alias.pattern)) throw new TypeError(`Duplicate tsconfig path alias pattern ${alias.pattern}.`);
|
|
189
|
+
patterns.add(alias.pattern);
|
|
190
|
+
}
|
|
191
|
+
const semantic = Object.freeze({
|
|
192
|
+
version: MODULE_RESOLVER_INPUT_VERSION,
|
|
193
|
+
resolverVersion: MODULE_RESOLVER_CONTRACT_VERSION,
|
|
194
|
+
baseUrl: normalizeDirectoryPath(input.baseUrl, 'baseUrl'),
|
|
195
|
+
pathAliases: aliases,
|
|
196
|
+
configFile: input.configFile == null ? null : normalizePortablePath(input.configFile, 'configFile'),
|
|
197
|
+
configContentHash: assertSha256(input.configContentHash, 'configContentHash', { nullable: true })
|
|
198
|
+
});
|
|
199
|
+
return Object.freeze({ ...semantic, resolverHash: sha256Hex(stableStringify(semantic)) });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function matchPathAlias(specifierInput, resolverInput) {
|
|
203
|
+
const specifier = normalizeModuleSpecifier(specifierInput);
|
|
204
|
+
const resolver = normalizeModuleResolverInput(resolverInput || {});
|
|
205
|
+
for (const alias of resolver.pathAliases) {
|
|
206
|
+
if (!alias.wildcard) {
|
|
207
|
+
if (specifier !== alias.pattern) continue;
|
|
208
|
+
return Object.freeze({ alias, capture: null });
|
|
209
|
+
}
|
|
210
|
+
if (!specifier.startsWith(alias.prefix) || !specifier.endsWith(alias.suffix)) continue;
|
|
211
|
+
const capture = specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
|
|
212
|
+
return Object.freeze({ alias, capture });
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function parsePackageSpecifier(specifierInput) {
|
|
218
|
+
const specifier = normalizeModuleSpecifier(specifierInput);
|
|
219
|
+
if (specifier.startsWith('.') || EXTERNAL_SCHEMES.some((scheme) => specifier.startsWith(scheme))) return null;
|
|
220
|
+
const segments = specifier.split('/');
|
|
221
|
+
const scoped = specifier.startsWith('@');
|
|
222
|
+
const packageName = scoped ? segments.slice(0, 2).join('/') : segments[0];
|
|
223
|
+
const rest = scoped ? segments.slice(2) : segments.slice(1);
|
|
224
|
+
if (!packageName || (scoped && segments.length < 2)) throw new TypeError(`Invalid package specifier ${specifier}.`);
|
|
225
|
+
return Object.freeze({
|
|
226
|
+
packageName,
|
|
227
|
+
packageSubpath: rest.length === 0 ? '.' : `./${rest.join('/')}`,
|
|
228
|
+
kind: rest.length === 0 ? 'package-root' : 'package-subpath'
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function classifyModuleSpecifier(specifierInput, resolverInput = {}) {
|
|
233
|
+
const specifier = normalizeModuleSpecifier(specifierInput);
|
|
234
|
+
if (EXTERNAL_SCHEMES.some((scheme) => specifier.startsWith(scheme))) return Object.freeze({ kind: 'external', specifier });
|
|
235
|
+
if (specifier.startsWith('./') || specifier.startsWith('../')) return Object.freeze({ kind: 'project-relative', specifier });
|
|
236
|
+
const aliasMatch = matchPathAlias(specifier, resolverInput);
|
|
237
|
+
if (aliasMatch) return Object.freeze({ kind: 'tsconfig-path', specifier, alias: aliasMatch.alias.pattern, capture: aliasMatch.capture });
|
|
238
|
+
const parsed = parsePackageSpecifier(specifier);
|
|
239
|
+
if (!parsed) throw new TypeError(`Unsupported module specifier ${specifier}.`);
|
|
240
|
+
return Object.freeze({ ...parsed, specifier });
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function extensionCandidates(portableBase) {
|
|
244
|
+
const extension = path.posix.extname(portableBase);
|
|
245
|
+
const candidates = [portableBase];
|
|
246
|
+
const substitutions = TYPESCRIPT_EXTENSION_SUBSTITUTIONS[extension];
|
|
247
|
+
if (substitutions) {
|
|
248
|
+
const stem = portableBase.slice(0, -extension.length);
|
|
249
|
+
for (const replacement of substitutions) candidates.push(`${stem}${replacement}`);
|
|
250
|
+
} else if (!extension) {
|
|
251
|
+
for (const suffix of PROJECT_SOURCE_EXTENSIONS) candidates.push(`${portableBase}${suffix}`);
|
|
252
|
+
for (const suffix of PROJECT_SOURCE_EXTENSIONS) candidates.push(path.posix.join(portableBase, `index${suffix}`));
|
|
253
|
+
}
|
|
254
|
+
return Object.freeze(Array.from(new Set(candidates)));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function projectResolutionCandidates(importerPathInput, specifierInput, resolverInput = {}) {
|
|
258
|
+
const importerPath = normalizePortablePath(importerPathInput, 'importerPath');
|
|
259
|
+
const specifier = normalizeModuleSpecifier(specifierInput);
|
|
260
|
+
const resolver = normalizeModuleResolverInput(resolverInput || {});
|
|
261
|
+
const classification = classifyModuleSpecifier(specifier, resolver);
|
|
262
|
+
let bases = [];
|
|
263
|
+
if (classification.kind === 'project-relative') {
|
|
264
|
+
const base = path.posix.join(path.posix.dirname(importerPath), specifier);
|
|
265
|
+
bases = [normalizePortablePath(base, 'relative resolution candidate')];
|
|
266
|
+
} else if (classification.kind === 'tsconfig-path') {
|
|
267
|
+
const match = matchPathAlias(specifier, resolver);
|
|
268
|
+
bases = match.alias.targets.map((target) => {
|
|
269
|
+
const replaced = match.capture == null ? target : target.replace('*', match.capture);
|
|
270
|
+
const joined = resolver.baseUrl === '.' ? replaced : path.posix.join(resolver.baseUrl, replaced);
|
|
271
|
+
return normalizePortablePath(joined, 'tsconfig path resolution candidate');
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
return Object.freeze([]);
|
|
275
|
+
}
|
|
276
|
+
const candidates = [];
|
|
277
|
+
for (const base of bases) candidates.push(...extensionCandidates(base));
|
|
278
|
+
return Object.freeze(Array.from(new Set(candidates)));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
module.exports = Object.freeze({
|
|
282
|
+
MODULE_RESOLVER_CONTRACT_VERSION,
|
|
283
|
+
MODULE_RESOLVER_INPUT_VERSION,
|
|
284
|
+
RESOLUTION_KINDS,
|
|
285
|
+
PROJECT_SOURCE_EXTENSIONS,
|
|
286
|
+
TYPE_DECLARATION_EXTENSIONS,
|
|
287
|
+
RUNTIME_PACKAGE_CONDITIONS,
|
|
288
|
+
TYPE_PACKAGE_CONDITIONS,
|
|
289
|
+
PACKAGE_ROOT_FIELDS,
|
|
290
|
+
TYPE_ROOT_FIELDS,
|
|
291
|
+
CANDIDATE_STEPS,
|
|
292
|
+
TYPESCRIPT_EXTENSION_SUBSTITUTIONS,
|
|
293
|
+
EXTERNAL_SCHEMES,
|
|
294
|
+
normalizePortablePath,
|
|
295
|
+
normalizeDirectoryPath,
|
|
296
|
+
normalizeModuleSpecifier,
|
|
297
|
+
normalizeModuleResolverInput,
|
|
298
|
+
defaultModuleResolverContract,
|
|
299
|
+
matchPathAlias,
|
|
300
|
+
parsePackageSpecifier,
|
|
301
|
+
classifyModuleSpecifier,
|
|
302
|
+
projectResolutionCandidates
|
|
303
|
+
});
|