@softarc/native-federation 4.1.2 → 4.2.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.md +7 -0
- package/README.md +638 -0
- package/dist/config.js +17 -0
- package/dist/domain.js +2 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +21 -0
- package/{src → dist}/internal.d.ts +6 -7
- package/dist/internal.js +26 -0
- package/dist/lib/config/configuration-context.js +15 -0
- package/dist/lib/config/default-skip-list.js +36 -0
- package/dist/lib/config/get-external-imports.d.ts +2 -0
- package/dist/lib/config/get-external-imports.js +60 -0
- package/dist/lib/config/get-used-dependencies.d.ts +24 -0
- package/dist/lib/config/get-used-dependencies.js +126 -0
- package/{src/lib/utils → dist/lib/config}/mapped-paths.d.ts +2 -2
- package/dist/lib/config/mapped-paths.js +31 -0
- package/dist/lib/config/remove-unused-deps.js +11 -0
- package/dist/lib/config/share-utils.d.ts +20 -0
- package/dist/lib/config/share-utils.js +344 -0
- package/dist/lib/config/with-native-federation.js +80 -0
- package/{src/lib/core → dist/lib/core/build}/build-adapter.d.ts +1 -1
- package/dist/lib/core/build/build-adapter.js +16 -0
- package/dist/lib/core/build/build-for-federation.d.ts +4 -0
- package/dist/lib/core/build/build-for-federation.js +207 -0
- package/{src/lib/utils → dist/lib/core/build}/build-result-map.d.ts +1 -1
- package/dist/lib/core/build/build-result-map.js +39 -0
- package/dist/lib/core/build/bundle-exposed-and-mappings.d.ts +13 -0
- package/dist/lib/core/build/bundle-exposed-and-mappings.js +178 -0
- package/dist/lib/core/build/bundle-shared.d.ts +34 -0
- package/dist/lib/core/build/bundle-shared.js +261 -0
- package/dist/lib/core/build/compute-integrity.d.ts +11 -0
- package/dist/lib/core/build/compute-integrity.js +20 -0
- package/dist/lib/core/build/default-external-list.js +32 -0
- package/dist/lib/core/build/get-externals.d.ts +2 -0
- package/dist/lib/core/build/get-externals.js +9 -0
- package/dist/lib/core/build/rebuild-for-federation.d.ts +4 -0
- package/dist/lib/core/build/rebuild-for-federation.js +52 -0
- package/dist/lib/core/build/rewrite-chunk-imports.d.ts +5 -0
- package/dist/lib/core/build/rewrite-chunk-imports.js +74 -0
- package/dist/lib/core/cache/cache-persistence.d.ts +22 -0
- package/dist/lib/core/cache/cache-persistence.js +63 -0
- package/{src/lib/core → dist/lib/core/cache}/federation-cache.d.ts +2 -2
- package/dist/lib/core/cache/federation-cache.js +22 -0
- package/dist/lib/core/federation-builder.js +53 -0
- package/{src → dist}/lib/core/normalize-options.d.ts +13 -1
- package/dist/lib/core/normalize-options.js +67 -0
- package/dist/lib/core/output/write-federation-info.d.ts +5 -0
- package/dist/lib/core/output/write-federation-info.js +17 -0
- package/dist/lib/core/output/write-import-map.d.ts +11 -0
- package/dist/lib/core/output/write-import-map.js +42 -0
- package/dist/lib/core/rebuild-queue.js +61 -0
- package/{src → dist}/lib/domain/config/external-config.contract.d.ts +2 -2
- package/dist/lib/domain/config/external-config.contract.js +0 -0
- package/{src → dist}/lib/domain/config/federation-config.contract.d.ts +6 -2
- package/dist/lib/domain/config/federation-config.contract.js +0 -0
- package/dist/lib/domain/config/index.js +0 -0
- package/dist/lib/domain/config/skip-list.contract.js +0 -0
- package/dist/lib/domain/core/build-adapter.contract.js +0 -0
- package/dist/lib/domain/core/build-notification-options.contract.js +9 -0
- package/dist/lib/domain/core/chunk.js +12 -0
- package/dist/lib/domain/core/federation-cache.contract.js +0 -0
- package/{src → dist}/lib/domain/core/federation-info.contract.d.ts +1 -0
- package/dist/lib/domain/core/federation-info.contract.js +0 -0
- package/dist/lib/domain/core/federation-options.contract.js +0 -0
- package/{src → dist}/lib/domain/core/index.d.ts +1 -0
- package/dist/lib/domain/core/index.js +9 -0
- package/dist/lib/domain/core/manifest.contract.d.ts +5 -0
- package/dist/lib/domain/core/manifest.contract.js +0 -0
- package/dist/lib/domain/utils/file-watcher.contract.js +0 -0
- package/dist/lib/domain/utils/io-port.contract.d.ts +45 -0
- package/dist/lib/domain/utils/io-port.contract.js +0 -0
- package/dist/lib/domain/utils/keyvaluepair.contract.js +0 -0
- package/dist/lib/domain/utils/mapped-path.contract.js +0 -0
- package/dist/lib/domain/utils/package-json.contract.d.ts +27 -0
- package/dist/lib/domain/utils/package-json.contract.js +0 -0
- package/dist/lib/domain/utils/used-dependencies.contract.js +0 -0
- package/dist/lib/utils/errors.js +10 -0
- package/{src → dist}/lib/utils/file-watcher.d.ts +2 -0
- package/dist/lib/utils/file-watcher.js +51 -0
- package/dist/lib/utils/hash-file.d.ts +7 -0
- package/dist/lib/utils/hash-file.js +15 -0
- package/dist/lib/utils/io/node-io-adapter.d.ts +2 -0
- package/dist/lib/utils/io/node-io-adapter.js +68 -0
- package/dist/lib/utils/io/package-json-repository.d.ts +5 -0
- package/dist/lib/utils/io/package-json-repository.js +79 -0
- package/dist/lib/utils/logger.js +29 -0
- package/dist/lib/utils/normalize.js +22 -0
- package/dist/lib/utils/package/entry-point-resolver.d.ts +2 -0
- package/dist/lib/utils/package/entry-point-resolver.js +78 -0
- package/dist/lib/utils/package/esm-detection.d.ts +5 -0
- package/dist/lib/utils/package/esm-detection.js +10 -0
- package/dist/lib/utils/package/exports-resolver.d.ts +13 -0
- package/dist/lib/utils/package/exports-resolver.js +55 -0
- package/dist/lib/utils/package/package-info.d.ts +7 -0
- package/dist/lib/utils/package/package-info.js +31 -0
- package/dist/lib/utils/package/resolve-wildcard-keys.d.ts +3 -0
- package/dist/lib/utils/package/resolve-wildcard-keys.js +22 -0
- package/dist/lib/utils/package/version-maps.d.ts +3 -0
- package/dist/lib/utils/package/version-maps.js +8 -0
- package/dist/lib/utils/path-patterns.d.ts +14 -0
- package/dist/lib/utils/path-patterns.js +28 -0
- package/package.json +45 -22
- package/src/config.js +0 -4
- package/src/domain.js +0 -2
- package/src/index.d.ts +0 -10
- package/src/index.js +0 -10
- package/src/internal.js +0 -11
- package/src/lib/config/configuration-context.js +0 -10
- package/src/lib/config/default-skip-list.js +0 -31
- package/src/lib/config/remove-unused-deps.js +0 -10
- package/src/lib/config/share-utils.d.ts +0 -10
- package/src/lib/config/share-utils.js +0 -302
- package/src/lib/config/with-native-federation.js +0 -71
- package/src/lib/core/build-adapter.js +0 -12
- package/src/lib/core/build-for-federation.d.ts +0 -4
- package/src/lib/core/build-for-federation.js +0 -173
- package/src/lib/core/bundle-exposed-and-mappings.d.ts +0 -7
- package/src/lib/core/bundle-exposed-and-mappings.js +0 -174
- package/src/lib/core/bundle-shared.d.ts +0 -13
- package/src/lib/core/bundle-shared.js +0 -222
- package/src/lib/core/default-external-list.js +0 -29
- package/src/lib/core/federation-builder.js +0 -45
- package/src/lib/core/federation-cache.js +0 -16
- package/src/lib/core/get-externals.d.ts +0 -2
- package/src/lib/core/get-externals.js +0 -6
- package/src/lib/core/normalize-options.js +0 -58
- package/src/lib/core/rebuild-for-federation.d.ts +0 -4
- package/src/lib/core/rebuild-for-federation.js +0 -43
- package/src/lib/core/write-federation-info.d.ts +0 -3
- package/src/lib/core/write-federation-info.js +0 -6
- package/src/lib/core/write-import-map.d.ts +0 -6
- package/src/lib/core/write-import-map.js +0 -33
- package/src/lib/domain/config/external-config.contract.js +0 -1
- package/src/lib/domain/config/federation-config.contract.js +0 -1
- package/src/lib/domain/config/index.js +0 -1
- package/src/lib/domain/config/skip-list.contract.js +0 -1
- package/src/lib/domain/config/with-native-federation.contract.d.ts +0 -2
- package/src/lib/domain/config/with-native-federation.contract.js +0 -1
- package/src/lib/domain/core/build-adapter.contract.js +0 -1
- package/src/lib/domain/core/build-notification-options.contract.js +0 -6
- package/src/lib/domain/core/chunk.js +0 -8
- package/src/lib/domain/core/federation-cache.contract.js +0 -1
- package/src/lib/domain/core/federation-info.contract.js +0 -1
- package/src/lib/domain/core/federation-options.contract.js +0 -1
- package/src/lib/domain/core/index.js +0 -2
- package/src/lib/domain/utils/file-watcher.contract.js +0 -1
- package/src/lib/domain/utils/index.d.ts +0 -2
- package/src/lib/domain/utils/index.js +0 -1
- package/src/lib/domain/utils/keyvaluepair.contract.js +0 -1
- package/src/lib/domain/utils/mapped-path.contract.js +0 -5
- package/src/lib/domain/utils/used-dependencies.contract.js +0 -1
- package/src/lib/utils/build-result-map.js +0 -29
- package/src/lib/utils/cache-persistence.d.ts +0 -19
- package/src/lib/utils/cache-persistence.js +0 -66
- package/src/lib/utils/errors.js +0 -7
- package/src/lib/utils/file-watcher.js +0 -51
- package/src/lib/utils/get-external-imports.d.ts +0 -1
- package/src/lib/utils/get-external-imports.js +0 -80
- package/src/lib/utils/get-used-dependencies.d.ts +0 -7
- package/src/lib/utils/get-used-dependencies.js +0 -123
- package/src/lib/utils/hash-file.d.ts +0 -3
- package/src/lib/utils/hash-file.js +0 -13
- package/src/lib/utils/logger.js +0 -27
- package/src/lib/utils/mapped-paths.js +0 -33
- package/src/lib/utils/normalize.js +0 -17
- package/src/lib/utils/package-info.d.ts +0 -30
- package/src/lib/utils/package-info.js +0 -268
- package/src/lib/utils/rebuild-queue.js +0 -63
- package/src/lib/utils/resolve-glob.d.ts +0 -1
- package/src/lib/utils/resolve-glob.js +0 -29
- package/src/lib/utils/resolve-wildcard-keys.d.ts +0 -29
- package/src/lib/utils/resolve-wildcard-keys.js +0 -126
- package/src/lib/utils/rewrite-chunk-imports.d.ts +0 -2
- package/src/lib/utils/rewrite-chunk-imports.js +0 -48
- /package/{src → dist}/config.d.ts +0 -0
- /package/{src → dist}/domain.d.ts +0 -0
- /package/{src → dist}/lib/config/configuration-context.d.ts +0 -0
- /package/{src → dist}/lib/config/default-skip-list.d.ts +0 -0
- /package/{src → dist}/lib/config/remove-unused-deps.d.ts +0 -0
- /package/{src → dist}/lib/config/with-native-federation.d.ts +0 -0
- /package/{src/lib/core → dist/lib/core/build}/default-external-list.d.ts +0 -0
- /package/{src → dist}/lib/core/federation-builder.d.ts +0 -0
- /package/{src/lib/utils → dist/lib/core}/rebuild-queue.d.ts +0 -0
- /package/{src → dist}/lib/domain/config/index.d.ts +0 -0
- /package/{src → dist}/lib/domain/config/skip-list.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/core/build-adapter.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/core/build-notification-options.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/core/chunk.d.ts +0 -0
- /package/{src → dist}/lib/domain/core/federation-cache.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/core/federation-options.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/utils/file-watcher.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/utils/keyvaluepair.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/utils/mapped-path.contract.d.ts +0 -0
- /package/{src → dist}/lib/domain/utils/used-dependencies.contract.d.ts +0 -0
- /package/{src → dist}/lib/utils/errors.d.ts +0 -0
- /package/{src → dist}/lib/utils/logger.d.ts +0 -0
- /package/{src → dist}/lib/utils/normalize.d.ts +0 -0
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { getProjectData } from '@softarc/sheriff-core';
|
|
2
|
-
import { cwd } from 'process';
|
|
3
|
-
import { getPackageInfo } from './package-info.js';
|
|
4
|
-
import { getExternalImports as extractExternalImports } from './get-external-imports.js';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
export function getUsedDependenciesFactory(workspaceRoot, fallbackEntryPoints) {
|
|
7
|
-
return config => {
|
|
8
|
-
let entryPoints = Object.values(config.exposes ?? {});
|
|
9
|
-
if (entryPoints.length < 1)
|
|
10
|
-
entryPoints = fallbackEntryPoints;
|
|
11
|
-
if (!entryPoints || entryPoints.length < 1)
|
|
12
|
-
throw new Error('[removeUnusedDeps] native-federation is missing an entryPoint! You can set it using the Federation options or by setting an exposed module in the Federation config file.');
|
|
13
|
-
const fileInfos = Object.values(entryPoints ?? []).reduce((acc, entryPoint) => ({
|
|
14
|
-
...acc,
|
|
15
|
-
...getProjectData(entryPoint, cwd(), {
|
|
16
|
-
includeExternalLibraries: true,
|
|
17
|
-
}),
|
|
18
|
-
}), {});
|
|
19
|
-
const usedPackageNames = new Set();
|
|
20
|
-
for (const fileInfo of Object.values(fileInfos)) {
|
|
21
|
-
for (const pckg of [
|
|
22
|
-
...(fileInfo?.externalLibraries || []),
|
|
23
|
-
...(fileInfo?.unresolvedImports || []),
|
|
24
|
-
]) {
|
|
25
|
-
usedPackageNames.add(pckg);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
external: addTransientDeps(usedPackageNames, workspaceRoot),
|
|
30
|
-
internal: resolveUsedMappings(fileInfos, workspaceRoot, config.sharedMappings),
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function addTransientDeps(packages, workspaceRoot) {
|
|
35
|
-
const packagesAndPeers = new Set([...packages]);
|
|
36
|
-
const discovered = new Set(packagesAndPeers);
|
|
37
|
-
const stack = [...packagesAndPeers];
|
|
38
|
-
while (stack.length > 0) {
|
|
39
|
-
const dep = stack.pop();
|
|
40
|
-
if (!dep) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const pInfo = getPackageInfo(dep, workspaceRoot);
|
|
44
|
-
if (!pInfo) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
const peerDeps = extractExternalImports(pInfo.entryPoint);
|
|
48
|
-
for (const peerDep of peerDeps) {
|
|
49
|
-
if (!discovered.has(peerDep)) {
|
|
50
|
-
discovered.add(peerDep);
|
|
51
|
-
stack.push(peerDep);
|
|
52
|
-
packagesAndPeers.add(peerDep);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return packagesAndPeers;
|
|
57
|
-
}
|
|
58
|
-
function resolveUsedMappings(fileInfos, workspaceRoot, sharedMappings) {
|
|
59
|
-
const usedMappings = {};
|
|
60
|
-
for (const fileName of Object.keys(fileInfos)) {
|
|
61
|
-
const fullFileName = path.join(workspaceRoot, fileName);
|
|
62
|
-
if (isSharedMapping(fullFileName, sharedMappings))
|
|
63
|
-
continue;
|
|
64
|
-
const fileInfo = fileInfos[fileName];
|
|
65
|
-
if (!fileInfo)
|
|
66
|
-
continue;
|
|
67
|
-
// Check if any of this file's imports land in a shared mapping
|
|
68
|
-
for (const imp of fileInfo.imports ?? []) {
|
|
69
|
-
const fullImport = path.join(workspaceRoot, imp);
|
|
70
|
-
const match = matchMapping(fullImport, sharedMappings);
|
|
71
|
-
if (match)
|
|
72
|
-
usedMappings[fullImport] = match;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return usedMappings;
|
|
76
|
-
}
|
|
77
|
-
function isSharedMapping(filePath, sharedMappings) {
|
|
78
|
-
for (const sharedPath of Object.keys(sharedMappings)) {
|
|
79
|
-
const asteriskIndex = sharedPath.indexOf('*');
|
|
80
|
-
if (asteriskIndex !== -1) {
|
|
81
|
-
const prefix = sharedPath.substring(0, asteriskIndex);
|
|
82
|
-
if (filePath.startsWith(prefix))
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
else if (filePath.startsWith(sharedPath + path.sep) || filePath === sharedPath) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
function matchMapping(filePath, sharedMappings) {
|
|
92
|
-
for (const [sharedPath, sharedImport] of Object.entries(sharedMappings)) {
|
|
93
|
-
const asteriskIndex = sharedPath.indexOf('*');
|
|
94
|
-
if (asteriskIndex !== -1) {
|
|
95
|
-
const prefix = sharedPath.substring(0, asteriskIndex);
|
|
96
|
-
const suffix = sharedPath.substring(asteriskIndex + 1);
|
|
97
|
-
if (!filePath.startsWith(prefix))
|
|
98
|
-
continue;
|
|
99
|
-
if (suffix && !filePath.includes(suffix))
|
|
100
|
-
continue;
|
|
101
|
-
const captured = suffix
|
|
102
|
-
? filePath.slice(prefix.length, filePath.indexOf(suffix, prefix.length))
|
|
103
|
-
: filePath.slice(prefix.length);
|
|
104
|
-
return sharedImport.replace('*', toImportPath(captured));
|
|
105
|
-
}
|
|
106
|
-
else if (filePath === sharedPath || isIndexOf(filePath, sharedPath)) {
|
|
107
|
-
return sharedImport;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Detect if it's a barrel file which is inferred by typescript
|
|
114
|
-
*/
|
|
115
|
-
const INDEX_PATTERN = /\/index\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/;
|
|
116
|
-
function isIndexOf(filePath, dirPath) {
|
|
117
|
-
return filePath.startsWith(dirPath + path.sep) && INDEX_PATTERN.test(filePath);
|
|
118
|
-
}
|
|
119
|
-
function toImportPath(filePath) {
|
|
120
|
-
const withoutExt = filePath.replace(/\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/, '');
|
|
121
|
-
const normalized = withoutExt.replace(/\\/g, '/');
|
|
122
|
-
return normalized.endsWith('/index') ? normalized.slice(0, -6) : normalized;
|
|
123
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as crypto from 'crypto';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
export function hashFile(fileName) {
|
|
4
|
-
const fileBuffer = fs.readFileSync(fileName);
|
|
5
|
-
const hashSum = crypto.createHash('md5');
|
|
6
|
-
hashSum.update(fileBuffer);
|
|
7
|
-
return hashSum.digest('hex');
|
|
8
|
-
}
|
|
9
|
-
export function integrityForFile(fileName, algorithm = 'sha384') {
|
|
10
|
-
const fileBuffer = fs.readFileSync(fileName);
|
|
11
|
-
const hash = crypto.createHash(algorithm).update(fileBuffer).digest('base64');
|
|
12
|
-
return `${algorithm}-${hash}`;
|
|
13
|
-
}
|
package/src/lib/utils/logger.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
let verbose = false;
|
|
4
|
-
export const logger = {
|
|
5
|
-
warn: (msg) => console.warn(chalk.bgYellow.ansi256(15)(' WARN '), msg),
|
|
6
|
-
error: (msg) => console.error(chalk.bgRed.ansi256(15)(' ERRR '), msg),
|
|
7
|
-
notice: (msg) => console.log(chalk.bgYellowBright.black(' NOTE '), msg),
|
|
8
|
-
info: (msg) => console.log(chalk.bgGreen.ansi256(15)(' INFO '), msg),
|
|
9
|
-
verbose: (msg) => verbose && console.log(chalk.bgGreen.ansi256(15)(' DBG! '), msg),
|
|
10
|
-
debug: (msg) => verbose && console.log(chalk.bgGreen.ansi256(15)(' DBG! '), msg),
|
|
11
|
-
measure: (start, milestone) => {
|
|
12
|
-
if (!verbose)
|
|
13
|
-
return;
|
|
14
|
-
const [totalSeconds, nanoseconds] = process.hrtime(start);
|
|
15
|
-
const minutes = Math.floor(totalSeconds / 60);
|
|
16
|
-
const seconds = totalSeconds % 60;
|
|
17
|
-
const milliseconds = nanoseconds / 1000000;
|
|
18
|
-
const msFormatted = milliseconds.toFixed(3);
|
|
19
|
-
const timeStr = `${minutes.toString().padStart(2, '0')}:${seconds
|
|
20
|
-
.toString()
|
|
21
|
-
.padStart(2, '0')}:${msFormatted.padStart(7, '0')}ms`;
|
|
22
|
-
console.log(chalk.bgGreen.ansi256(15)(' DBG! '), `${timeStr} - ${milestone}`);
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
export const setLogLevel = (level) => {
|
|
26
|
-
verbose = level === 'verbose';
|
|
27
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import JSON5 from 'json5';
|
|
4
|
-
/**
|
|
5
|
-
* Will return user defined and tsconfig defined paths including their imports, might contain wildcards
|
|
6
|
-
* @param param0
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export function getRawMappedPaths(rootTsConfigPath, configuredSharedMappings, rootPath) {
|
|
10
|
-
const mappedPaths = {};
|
|
11
|
-
if (!path.isAbsolute(rootTsConfigPath)) {
|
|
12
|
-
throw new Error('SharedMappings.register: tsConfigPath needs to be an absolute path!');
|
|
13
|
-
}
|
|
14
|
-
if (!rootPath) {
|
|
15
|
-
rootPath = path.normalize(path.dirname(rootTsConfigPath));
|
|
16
|
-
}
|
|
17
|
-
const shareAll = !configuredSharedMappings;
|
|
18
|
-
if (!configuredSharedMappings) {
|
|
19
|
-
configuredSharedMappings = [];
|
|
20
|
-
}
|
|
21
|
-
const tsConfig = JSON5.parse(fs.readFileSync(rootTsConfigPath, { encoding: 'utf-8' }));
|
|
22
|
-
const mappings = tsConfig?.compilerOptions?.paths;
|
|
23
|
-
if (!mappings) {
|
|
24
|
-
return mappedPaths;
|
|
25
|
-
}
|
|
26
|
-
for (const key in mappings) {
|
|
27
|
-
const libPath = path.normalize(path.join(rootPath, mappings[key][0]));
|
|
28
|
-
if (configuredSharedMappings.includes(key) || shareAll) {
|
|
29
|
-
mappedPaths[libPath] = key;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return mappedPaths;
|
|
33
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function normalize(path, trailingSlash) {
|
|
2
|
-
let cand = path.replace(/\\/g, '/');
|
|
3
|
-
if (typeof trailingSlash === 'undefined') {
|
|
4
|
-
return cand;
|
|
5
|
-
}
|
|
6
|
-
while (cand.endsWith('/')) {
|
|
7
|
-
cand = cand.substring(0, cand.length - 1);
|
|
8
|
-
}
|
|
9
|
-
if (trailingSlash) {
|
|
10
|
-
return cand + '/';
|
|
11
|
-
}
|
|
12
|
-
return cand;
|
|
13
|
-
}
|
|
14
|
-
export function normalizePackageName(fileName) {
|
|
15
|
-
const sanitized = fileName.replace(/[^A-Za-z0-9]/g, '_');
|
|
16
|
-
return sanitized.startsWith('_') ? sanitized.slice(1) : sanitized;
|
|
17
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface PackageInfo {
|
|
2
|
-
packageName: string;
|
|
3
|
-
entryPoint: string;
|
|
4
|
-
version: string;
|
|
5
|
-
esm: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface PartialPackageJson {
|
|
8
|
-
module: string;
|
|
9
|
-
main: string;
|
|
10
|
-
}
|
|
11
|
-
export type VersionMap = Record<string, string>;
|
|
12
|
-
export type PackageJsonInfo = {
|
|
13
|
-
content: any;
|
|
14
|
-
directory: string;
|
|
15
|
-
};
|
|
16
|
-
export type ExportCondition = 'import' | 'require' | 'node' | 'cjs' | 'esm' | 'default' | 'types' | 'browser' | (string & {});
|
|
17
|
-
export declare const isESMExport: (e: string) => boolean | undefined;
|
|
18
|
-
export type ExportEntry = string | undefined | {
|
|
19
|
-
[key in ExportCondition]?: ExportEntry;
|
|
20
|
-
} | ExportEntry[];
|
|
21
|
-
export type PackageJsonExports = string | ExportEntry | {
|
|
22
|
-
[path: `.${string}`]: ExportEntry;
|
|
23
|
-
};
|
|
24
|
-
export declare function findPackageJsonFiles(project: string, workspace: string): string[];
|
|
25
|
-
export declare function expandFolders(child: string, parent: string): string[];
|
|
26
|
-
export declare function getPackageInfo(packageName: string, workspaceRoot: string): PackageInfo | null;
|
|
27
|
-
export declare function getVersionMaps(project: string, workspace: string): VersionMap[];
|
|
28
|
-
export declare function getPackageJsonFiles(project: string, workspace: string): PackageJsonInfo[];
|
|
29
|
-
export declare function findDepPackageJson(packageName: string, projectRoot: string): string | null;
|
|
30
|
-
export declare function _getPackageInfo(packageName: string, directory: string): PackageInfo | null;
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { logger } from './logger.js';
|
|
4
|
-
import { normalize } from './normalize.js';
|
|
5
|
-
export const isESMExport = (e) => {
|
|
6
|
-
if (e === 'import' || e === 'module-sync')
|
|
7
|
-
return true;
|
|
8
|
-
// Common ESM conventions
|
|
9
|
-
if (e === 'module' || e === 'esm' || /^es20\d{2}$/.test(e))
|
|
10
|
-
return true;
|
|
11
|
-
if (e === 'require')
|
|
12
|
-
return false;
|
|
13
|
-
// Common CJS conventions
|
|
14
|
-
if (e === 'cjs' || e === 'commonjs')
|
|
15
|
-
return false;
|
|
16
|
-
// Ambiguous
|
|
17
|
-
return undefined;
|
|
18
|
-
};
|
|
19
|
-
const packageCache = {};
|
|
20
|
-
export function findPackageJsonFiles(project, workspace) {
|
|
21
|
-
return expandFolders(project, workspace)
|
|
22
|
-
.map(f => path.join(f, 'package.json'))
|
|
23
|
-
.filter(f => fs.existsSync(f));
|
|
24
|
-
}
|
|
25
|
-
export function expandFolders(child, parent) {
|
|
26
|
-
const result = [];
|
|
27
|
-
parent = normalize(parent, true);
|
|
28
|
-
child = normalize(child, true);
|
|
29
|
-
if (!child.startsWith(parent)) {
|
|
30
|
-
throw new Error(`Workspace folder ${path} needs to be a parent of the project folder ${child}`);
|
|
31
|
-
}
|
|
32
|
-
let current = child;
|
|
33
|
-
while (current !== parent) {
|
|
34
|
-
result.push(current);
|
|
35
|
-
const cand = normalize(path.dirname(current), true);
|
|
36
|
-
if (cand === current) {
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
current = cand;
|
|
40
|
-
}
|
|
41
|
-
result.push(parent);
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
export function getPackageInfo(packageName, workspaceRoot) {
|
|
45
|
-
workspaceRoot = normalize(workspaceRoot, true);
|
|
46
|
-
const packageJsonInfos = getPackageJsonFiles(workspaceRoot, workspaceRoot);
|
|
47
|
-
for (const info of packageJsonInfos) {
|
|
48
|
-
const cand = _getPackageInfo(packageName, info.directory);
|
|
49
|
-
if (cand) {
|
|
50
|
-
return cand;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
logger.warn('No meta data found for shared lib ' + packageName);
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
function getVersionMapCacheKey(project, workspace) {
|
|
57
|
-
return `${project}**${workspace}`;
|
|
58
|
-
}
|
|
59
|
-
export function getVersionMaps(project, workspace) {
|
|
60
|
-
return getPackageJsonFiles(project, workspace).map(json => ({
|
|
61
|
-
...json.content['dependencies'],
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
export function getPackageJsonFiles(project, workspace) {
|
|
65
|
-
const cacheKey = getVersionMapCacheKey(project, workspace);
|
|
66
|
-
let maps = packageCache[cacheKey];
|
|
67
|
-
if (maps) {
|
|
68
|
-
return maps;
|
|
69
|
-
}
|
|
70
|
-
maps = findPackageJsonFiles(project, workspace).map(f => {
|
|
71
|
-
const content = JSON.parse(fs.readFileSync(f, 'utf-8'));
|
|
72
|
-
const directory = normalize(path.dirname(f), true);
|
|
73
|
-
const result = {
|
|
74
|
-
content,
|
|
75
|
-
directory,
|
|
76
|
-
};
|
|
77
|
-
return result;
|
|
78
|
-
});
|
|
79
|
-
packageCache[cacheKey] = maps;
|
|
80
|
-
return maps;
|
|
81
|
-
}
|
|
82
|
-
export function findDepPackageJson(packageName, projectRoot) {
|
|
83
|
-
const mainPkgName = getPkgFolder(packageName);
|
|
84
|
-
if (!mainPkgName)
|
|
85
|
-
throw new Error(`Package.json "${packageName}" is missing`);
|
|
86
|
-
let mainPkgPath = path.join(projectRoot, 'node_modules', mainPkgName);
|
|
87
|
-
let mainPkgJsonPath = path.join(mainPkgPath, 'package.json');
|
|
88
|
-
let directory = projectRoot;
|
|
89
|
-
while (path.dirname(directory) !== directory) {
|
|
90
|
-
if (fs.existsSync(mainPkgJsonPath)) {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
directory = normalize(path.dirname(directory), true);
|
|
94
|
-
mainPkgPath = path.join(directory, 'node_modules', mainPkgName);
|
|
95
|
-
mainPkgJsonPath = path.join(mainPkgPath, 'package.json');
|
|
96
|
-
}
|
|
97
|
-
if (!fs.existsSync(mainPkgJsonPath)) {
|
|
98
|
-
// TODO: Add logger
|
|
99
|
-
// context.logger.warn('No package.json found for ' + packageName);
|
|
100
|
-
logger.verbose('No package.json found for ' + packageName + ' in ' + mainPkgPath);
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
return mainPkgJsonPath;
|
|
104
|
-
}
|
|
105
|
-
function replaceGlob(target, replacement) {
|
|
106
|
-
if (!target)
|
|
107
|
-
return undefined;
|
|
108
|
-
if (typeof target === 'string')
|
|
109
|
-
return target.replace('*', replacement);
|
|
110
|
-
return Object.entries(target).reduce((a, [k, v]) => ({
|
|
111
|
-
...a,
|
|
112
|
-
[k]: replaceGlob(v, replacement),
|
|
113
|
-
}), {});
|
|
114
|
-
}
|
|
115
|
-
function findOptimalExport(target, info, isESM = undefined) {
|
|
116
|
-
if (typeof target === 'string') {
|
|
117
|
-
return {
|
|
118
|
-
...info,
|
|
119
|
-
entryPoint: path.join(info.entryPoint, target),
|
|
120
|
-
esm: isESM ?? info.esm,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
if (!target)
|
|
124
|
-
return undefined;
|
|
125
|
-
if (Array.isArray(target))
|
|
126
|
-
return findOptimalExport(target[0], info, isESM);
|
|
127
|
-
const exportTypes = Object.keys(target);
|
|
128
|
-
// We prefer ESM exports for native support.
|
|
129
|
-
if (typeof isESM === 'undefined') {
|
|
130
|
-
const esmExport = exportTypes.find(e => isESMExport(e));
|
|
131
|
-
if (esmExport) {
|
|
132
|
-
return findOptimalExport(target[esmExport], info, true);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Node.js looks at the exports object and uses the first key that matches the current environment.
|
|
136
|
-
const secondBestEntry = 'default' in target && target['default']
|
|
137
|
-
? 'default'
|
|
138
|
-
: exportTypes.filter(e => e !== 'types')[0];
|
|
139
|
-
const secondBestExport = target[secondBestEntry];
|
|
140
|
-
return findOptimalExport(secondBestExport, info, isESM ?? isESMExport(secondBestEntry));
|
|
141
|
-
}
|
|
142
|
-
export function _getPackageInfo(packageName, directory) {
|
|
143
|
-
const mainPkgName = getPkgFolder(packageName);
|
|
144
|
-
if (!mainPkgName)
|
|
145
|
-
throw new Error(`Could not resolve "${packageName}" in "${directory}`);
|
|
146
|
-
const mainPkgJsonPath = findDepPackageJson(packageName, directory);
|
|
147
|
-
if (!mainPkgJsonPath) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
const mainPkgPath = path.dirname(mainPkgJsonPath);
|
|
151
|
-
const mainPkgJson = readJson(mainPkgJsonPath);
|
|
152
|
-
const version = mainPkgJson['version'];
|
|
153
|
-
const esm = mainPkgJson['type'] === 'module';
|
|
154
|
-
if (!version) {
|
|
155
|
-
logger.warn('No version found for ' + packageName);
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
const pathToSecondary = path.relative(mainPkgName, packageName);
|
|
159
|
-
const relSecondaryPath = !pathToSecondary ? '.' : './' + pathToSecondary.replace(/\\/g, '/');
|
|
160
|
-
let secondaryEntryPoint = undefined;
|
|
161
|
-
const packageJsonExportsEntry = Object.keys(mainPkgJson?.exports ?? []).find(e => {
|
|
162
|
-
if (e === relSecondaryPath)
|
|
163
|
-
return true;
|
|
164
|
-
if (e === './*')
|
|
165
|
-
return true;
|
|
166
|
-
if (!e.endsWith('*'))
|
|
167
|
-
return false;
|
|
168
|
-
const globPath = e.substring(0, e.length - 1);
|
|
169
|
-
return relSecondaryPath.startsWith(globPath);
|
|
170
|
-
});
|
|
171
|
-
if (packageJsonExportsEntry) {
|
|
172
|
-
secondaryEntryPoint = mainPkgJson?.exports?.[packageJsonExportsEntry];
|
|
173
|
-
if (packageJsonExportsEntry.endsWith('*')) {
|
|
174
|
-
const replacement = relSecondaryPath.substring(packageJsonExportsEntry.length - 1);
|
|
175
|
-
secondaryEntryPoint = replaceGlob(secondaryEntryPoint, replacement);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (secondaryEntryPoint) {
|
|
179
|
-
const info = findOptimalExport(secondaryEntryPoint, {
|
|
180
|
-
entryPoint: mainPkgPath,
|
|
181
|
-
packageName,
|
|
182
|
-
version,
|
|
183
|
-
esm,
|
|
184
|
-
});
|
|
185
|
-
if (info)
|
|
186
|
-
return info;
|
|
187
|
-
}
|
|
188
|
-
if (mainPkgJson['module'] && relSecondaryPath === '.') {
|
|
189
|
-
return {
|
|
190
|
-
entryPoint: path.join(mainPkgPath, mainPkgJson['module']),
|
|
191
|
-
packageName,
|
|
192
|
-
version,
|
|
193
|
-
esm: true,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
const secondaryPgkPath = path.join(mainPkgPath, relSecondaryPath);
|
|
197
|
-
const secondaryPgkJsonPath = path.join(secondaryPgkPath, 'package.json');
|
|
198
|
-
let secondaryPgkJson = null;
|
|
199
|
-
if (fs.existsSync(secondaryPgkJsonPath)) {
|
|
200
|
-
secondaryPgkJson = readJson(secondaryPgkJsonPath);
|
|
201
|
-
}
|
|
202
|
-
if (secondaryPgkJson && secondaryPgkJson.module) {
|
|
203
|
-
return {
|
|
204
|
-
entryPoint: path.join(secondaryPgkPath, secondaryPgkJson.module),
|
|
205
|
-
packageName,
|
|
206
|
-
version,
|
|
207
|
-
esm: true,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
let cand = path.join(secondaryPgkPath, 'index.mjs');
|
|
211
|
-
if (fs.existsSync(cand)) {
|
|
212
|
-
return {
|
|
213
|
-
entryPoint: cand,
|
|
214
|
-
packageName,
|
|
215
|
-
version,
|
|
216
|
-
esm: true,
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
if (secondaryPgkJson && secondaryPgkJson.main) {
|
|
220
|
-
return {
|
|
221
|
-
entryPoint: path.join(secondaryPgkPath, secondaryPgkJson.main),
|
|
222
|
-
packageName,
|
|
223
|
-
version,
|
|
224
|
-
esm,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
cand = path.join(secondaryPgkPath, 'index.js');
|
|
228
|
-
if (fs.existsSync(cand)) {
|
|
229
|
-
return {
|
|
230
|
-
entryPoint: cand,
|
|
231
|
-
packageName,
|
|
232
|
-
version,
|
|
233
|
-
esm,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
cand = secondaryPgkPath + '.js';
|
|
237
|
-
if (fs.existsSync(cand)) {
|
|
238
|
-
return {
|
|
239
|
-
entryPoint: cand,
|
|
240
|
-
packageName,
|
|
241
|
-
version,
|
|
242
|
-
esm,
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
cand = secondaryPgkPath + '.mjs';
|
|
246
|
-
if (fs.existsSync(cand)) {
|
|
247
|
-
return {
|
|
248
|
-
entryPoint: cand,
|
|
249
|
-
packageName,
|
|
250
|
-
version,
|
|
251
|
-
esm,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
logger.warn('No entry point found for ' + packageName);
|
|
255
|
-
logger.warn("If you don't need this package, skip it in your federation.config.js or consider moving it into depDependencies in your package.json");
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
function readJson(mainPkgJsonPath) {
|
|
259
|
-
return JSON.parse(fs.readFileSync(mainPkgJsonPath, 'utf-8'));
|
|
260
|
-
}
|
|
261
|
-
function getPkgFolder(packageName) {
|
|
262
|
-
const parts = packageName.split('/');
|
|
263
|
-
let folder = parts[0];
|
|
264
|
-
if (folder.startsWith('@')) {
|
|
265
|
-
folder += '/' + parts[1];
|
|
266
|
-
}
|
|
267
|
-
return folder;
|
|
268
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { logger } from './logger.js';
|
|
2
|
-
export class RebuildQueue {
|
|
3
|
-
activeBuilds = new Map();
|
|
4
|
-
buildCounter = 0;
|
|
5
|
-
async track(rebuildFn, interruptPromise) {
|
|
6
|
-
const buildId = ++this.buildCounter;
|
|
7
|
-
const pendingCancellations = Array.from(this.activeBuilds.values()).map(buildControl => {
|
|
8
|
-
buildControl.controller.abort();
|
|
9
|
-
return buildControl.buildFinished.promise;
|
|
10
|
-
});
|
|
11
|
-
if (pendingCancellations.length > 0) {
|
|
12
|
-
logger.info(`Aborting ${pendingCancellations.length} bundling task(s)..`);
|
|
13
|
-
await Promise.all(pendingCancellations);
|
|
14
|
-
}
|
|
15
|
-
let resolveCompletion;
|
|
16
|
-
const completionPromise = new Promise(resolve => {
|
|
17
|
-
resolveCompletion = resolve;
|
|
18
|
-
});
|
|
19
|
-
const control = {
|
|
20
|
-
controller: new AbortController(),
|
|
21
|
-
buildFinished: {
|
|
22
|
-
resolve: resolveCompletion,
|
|
23
|
-
promise: completionPromise,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
this.activeBuilds.set(buildId, control);
|
|
27
|
-
const buildPromise = rebuildFn(control.controller.signal)
|
|
28
|
-
.then(result => ({ type: 'completed', result }))
|
|
29
|
-
.catch(error => ({ type: 'completed', result: { success: false, error } }));
|
|
30
|
-
let trackResult;
|
|
31
|
-
try {
|
|
32
|
-
if (interruptPromise) {
|
|
33
|
-
const interruptResult = interruptPromise.then(value => ({
|
|
34
|
-
type: 'interrupted',
|
|
35
|
-
value,
|
|
36
|
-
}));
|
|
37
|
-
const raceResult = await Promise.race([buildPromise, interruptResult]);
|
|
38
|
-
if (raceResult.type === 'interrupted') {
|
|
39
|
-
control.controller.abort();
|
|
40
|
-
await buildPromise;
|
|
41
|
-
trackResult = raceResult;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
trackResult = raceResult;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
trackResult = await buildPromise;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
control.buildFinished.resolve();
|
|
53
|
-
this.activeBuilds.delete(buildId);
|
|
54
|
-
}
|
|
55
|
-
return trackResult;
|
|
56
|
-
}
|
|
57
|
-
dispose() {
|
|
58
|
-
for (const buildControl of this.activeBuilds.values()) {
|
|
59
|
-
buildControl.controller.abort();
|
|
60
|
-
}
|
|
61
|
-
this.activeBuilds.clear();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveGlobSync(pattern: string, baseDir?: string): string[];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
export function resolveGlobSync(pattern, baseDir = process.cwd()) {
|
|
4
|
-
if (pattern.startsWith('./')) {
|
|
5
|
-
pattern = pattern.substring(2);
|
|
6
|
-
}
|
|
7
|
-
const segments = pattern.split('/').filter(Boolean);
|
|
8
|
-
const results = [];
|
|
9
|
-
function search(dir, segmentIndex) {
|
|
10
|
-
if (segmentIndex >= segments.length) {
|
|
11
|
-
results.push(dir);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const segment = segments[segmentIndex];
|
|
15
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
16
|
-
if (segment === '*') {
|
|
17
|
-
entries
|
|
18
|
-
.filter(entry => entry.isDirectory())
|
|
19
|
-
.forEach(entry => search(path.join(dir, entry.name), segmentIndex + 1));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
entries
|
|
23
|
-
.filter(entry => entry.name === segment)
|
|
24
|
-
.forEach(entry => search(path.join(dir, entry.name), segmentIndex + 1));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
search(baseDir, 0);
|
|
28
|
-
return results;
|
|
29
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type KeyValuePair = {
|
|
2
|
-
key: string;
|
|
3
|
-
value: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Resolves tsconfig wildcard paths.
|
|
7
|
-
*
|
|
8
|
-
* In tsconfig.json, paths like `@features/*` → `libs/features/src/*` work as follows:
|
|
9
|
-
* - The `*` captures a single path segment (the module name)
|
|
10
|
-
* - When importing `@features/feature-a`, TypeScript captures `feature-a`
|
|
11
|
-
* - It then replaces `*` in the value pattern: `libs/features/src/feature-a`
|
|
12
|
-
*
|
|
13
|
-
* For discovery, we find all directories at the wildcard position that TypeScript
|
|
14
|
-
* would recognize as valid modules (directories with index files or package.json).
|
|
15
|
-
*
|
|
16
|
-
// @see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
|
|
17
|
-
*/
|
|
18
|
-
export declare function resolveTsConfigWildcard(keyPattern: string, valuePattern: string, cwd: string): KeyValuePair[];
|
|
19
|
-
/**
|
|
20
|
-
* Resolves package.json exports wildcard patterns.
|
|
21
|
-
*
|
|
22
|
-
* In package.json exports, patterns like `./features/*.js` → `./src/features/*.js` work as follows:
|
|
23
|
-
* - The `*` is a literal string replacement that can include path separators
|
|
24
|
-
* - Importing `pkg/features/a/b.js` captures `a/b` and replaces `*` → `./src/features/a/b.js`
|
|
25
|
-
* - This matches actual files, not directories
|
|
26
|
-
*
|
|
27
|
-
* @see https://nodejs.org/api/packages.html#subpath-patterns
|
|
28
|
-
*/
|
|
29
|
-
export declare function resolvePackageJsonExportsWildcard(keyPattern: string, valuePattern: string, cwd: string): KeyValuePair[];
|