@softarc/native-federation
Advanced tools
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| import type { UsedDependencies } from '../domain/utils/used-dependencies.contract.js'; | ||
| export declare function removeUnusedDeps(usedDependencies: UsedDependencies, config: NormalizedFederationConfig): NormalizedFederationConfig; |
| export function removeUnusedDeps(usedDependencies, config) { | ||
| const filteredDependencies = Object.entries(config.shared) | ||
| .filter(([shared, meta]) => !!meta.includeSecondaries || usedDependencies.external.has(shared)) | ||
| .reduce((acc, [shared, meta]) => ({ ...acc, [shared]: meta }), {}); | ||
| return { | ||
| ...config, | ||
| shared: filteredDependencies, | ||
| sharedMappings: usedDependencies.internal, | ||
| }; | ||
| } |
| import type { FederationCache } from '../domain/core/federation-cache.contract.js'; | ||
| import type { ChunkInfo, SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| export declare function createFederationCache(cachePath: string): FederationCache<undefined>; | ||
| export declare function createFederationCache<TBundlerCache>(cachePath: string, bundlerCache: TBundlerCache): FederationCache<TBundlerCache>; | ||
| export declare function addExternalsToCache(cache: FederationCache, { externals, chunks }: { | ||
| externals: SharedInfo[]; | ||
| chunks?: ChunkInfo; | ||
| }): void; |
| export function createFederationCache(cachePath, bundlerCache) { | ||
| return { externals: [], cachePath, bundlerCache }; | ||
| } | ||
| export function addExternalsToCache(cache, { externals, chunks }) { | ||
| cache.externals.push(...externals); | ||
| if (chunks) { | ||
| if (!cache.chunks) | ||
| cache.chunks = {}; | ||
| cache.chunks = { ...cache.chunks, ...chunks }; | ||
| } | ||
| } |
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| import type { FederationOptions, NormalizedFederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| import { type FederationCache } from '../../domain.js'; | ||
| export declare function normalizeFederationOptions(options: FederationOptions): Promise<{ | ||
| config: NormalizedFederationConfig; | ||
| options: NormalizedFederationOptions<undefined>; | ||
| }>; | ||
| export declare function normalizeFederationOptions<TBundlerCache>(options: FederationOptions, cache: FederationCache<TBundlerCache>): Promise<{ | ||
| config: NormalizedFederationConfig; | ||
| options: NormalizedFederationOptions<TBundlerCache>; | ||
| }>; | ||
| export declare function resolveProjectName(name?: string): string; |
| import * as path from 'path'; | ||
| import * as fs from 'fs'; | ||
| import { pathToFileURL } from 'url'; | ||
| import { removeUnusedDeps } from '../config/remove-unused-deps.js'; | ||
| import { createFederationCache } from './federation-cache.js'; | ||
| import { getDefaultCachePath } from '../utils/cache-persistence.js'; | ||
| import { getUsedDependenciesFactory } from '../utils/get-used-dependencies.js'; | ||
| import { logger } from '../utils/logger.js'; | ||
| import { normalizePackageName } from '../utils/normalize.js'; | ||
| export async function normalizeFederationOptions(options, cache) { | ||
| /** | ||
| * Step 1: normalizing config | ||
| */ | ||
| const fullConfigPath = path.join(options.workspaceRoot, options.federationConfig); | ||
| const getUsedDeps = getUsedDependenciesFactory(options.workspaceRoot, options.entryPoints); | ||
| if (!fs.existsSync(fullConfigPath)) { | ||
| throw new Error('Expected ' + fullConfigPath); | ||
| } | ||
| let config = (await import(pathToFileURL(fullConfigPath).href)) | ||
| ?.default; | ||
| /** | ||
| * Step 2: normalizing options | ||
| */ | ||
| const federationCache = cache ?? | ||
| createFederationCache(getDefaultCachePath(options.workspaceRoot)); | ||
| const normalizedOptions = { | ||
| ...options, | ||
| entryPoints: options.entryPoints ?? Object.values(config.exposes ?? {}), | ||
| projectName: resolveProjectName(options.projectName ?? config.name), | ||
| federationCache, | ||
| }; | ||
| /** | ||
| * Step 3: Remove unused deps | ||
| */ | ||
| if (config.features.ignoreUnusedDeps) { | ||
| config = removeUnusedDeps(getUsedDeps(config), config); | ||
| logger.info('Removed unused dependencies.'); | ||
| logger.debug('This can be disabled per dependency/external using the "includeSecondaries: {keepAll: true}" property. Or in general by disabling the "ignoreUnusedDeps" feature. '); | ||
| } | ||
| else { | ||
| const withWildcard = Object.keys(config.sharedMappings).some(m => m.includes('*')); | ||
| if (withWildcard) { | ||
| logger.warn('Sharing mapped paths with wildcards (*) is only supported with ignoreUnusedDeps feature.'); | ||
| config.sharedMappings = Object.entries(config.sharedMappings) | ||
| .filter(([_path]) => !_path.includes('*')) | ||
| .reduce((acc, [_path, _import]) => ({ ...acc, [_path]: _import }), {}); | ||
| } | ||
| } | ||
| return { config, options: normalizedOptions }; | ||
| } | ||
| export function resolveProjectName(name) { | ||
| if (!name || name.length < 1) { | ||
| logger.warn("Project name in 'federation.config.js' is empty, defaulting to 'shell' cache folder (could collide with other projects in the workspace)."); | ||
| return 'shell'; | ||
| } | ||
| return normalizePackageName(name); | ||
| } |
| import type { FederationInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { NormalizedFederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| export declare function rebuildForFederation(config: NormalizedFederationConfig, fedOptions: NormalizedFederationOptions, externals: string[], modifiedFiles: string[], signal?: AbortSignal): Promise<FederationInfo>; |
| import { bundleExposedAndMappings, describeExposed, describeSharedMappings, } from './bundle-exposed-and-mappings.js'; | ||
| import { writeFederationInfo } from './write-federation-info.js'; | ||
| import { writeImportMap } from './write-import-map.js'; | ||
| import { logger } from '../utils/logger.js'; | ||
| import { AbortedError } from '../utils/errors.js'; | ||
| export async function rebuildForFederation(config, fedOptions, externals, modifiedFiles, signal) { | ||
| const federationCache = fedOptions.federationCache; | ||
| logger.info(`Re-bundling all internal libraries and exposed modules..'`); | ||
| const start = process.hrtime(); | ||
| const artifactInfo = await bundleExposedAndMappings(config, fedOptions, externals, modifiedFiles, signal); | ||
| logger.measure(start, 'To re-bundle all internal libraries and exposed modules.'); | ||
| if (signal?.aborted) | ||
| throw new AbortedError('[buildForFederation] After exposed-and-mappings bundle'); | ||
| const exposedInfo = !artifactInfo ? describeExposed(config, fedOptions) : artifactInfo.exposes; | ||
| const sharedMappingInfo = !artifactInfo | ||
| ? describeSharedMappings(config, fedOptions) | ||
| : artifactInfo.mappings; | ||
| const sharedExternals = [...federationCache.externals, ...sharedMappingInfo]; | ||
| const buildNotificationsEndpoint = fedOptions.buildNotifications?.enable && fedOptions.dev | ||
| ? fedOptions.buildNotifications?.endpoint | ||
| : undefined; | ||
| const federationInfo = { | ||
| name: config.name, | ||
| shared: sharedExternals, | ||
| exposes: exposedInfo, | ||
| buildNotificationsEndpoint, | ||
| }; | ||
| if (federationCache.chunks) { | ||
| federationInfo.chunks = federationCache.chunks; | ||
| } | ||
| if (artifactInfo?.chunks) { | ||
| federationInfo.chunks = { ...(federationInfo.chunks ?? {}), ...artifactInfo?.chunks }; | ||
| } | ||
| writeFederationInfo(federationInfo, fedOptions); | ||
| writeImportMap(federationCache, fedOptions); | ||
| return federationInfo; | ||
| } |
| import type { NormalizedFederationConfig } from './federation-config.contract.js'; | ||
| export type WithNativeFederation = NormalizedFederationConfig; |
| export declare const CHUNK_PREFIX = "@nf-internal"; | ||
| export declare function toChunkImport(fileName: string): string; |
| export const CHUNK_PREFIX = '@nf-internal'; | ||
| export function toChunkImport(fileName) { | ||
| if (fileName.startsWith('./')) { | ||
| fileName = fileName.slice(2); | ||
| } | ||
| const packageName = fileName.replace(/.(m|c)?js$/, ''); | ||
| return CHUNK_PREFIX + '/' + packageName; | ||
| } |
| import type { ChunkInfo, SharedInfo } from './federation-info.contract.js'; | ||
| export type FederationCache<TBundlerCache = unknown> = { | ||
| externals: SharedInfo[]; | ||
| chunks?: ChunkInfo; | ||
| bundlerCache: TBundlerCache; | ||
| cachePath: string; | ||
| }; |
| export {}; |
| import type { PathToImport } from './mapped-path.contract.js'; | ||
| export type UsedDependencies = { | ||
| external: Set<string>; | ||
| internal: PathToImport; | ||
| }; |
| import type { NormalizedExternalConfig } from '../domain/config/external-config.contract.js'; | ||
| import type { ChunkInfo, SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| export declare const getDefaultCachePath: (workspaceRoot: string) => string; | ||
| export declare const getFilename: (title: string, dev?: boolean) => string; | ||
| export declare const getChecksum: (shared: Record<string, NormalizedExternalConfig>, dev: "1" | "0") => string; | ||
| export declare const cacheEntry: (pathToCache: string, fileName: string) => { | ||
| getMetadata: (checksum: string) => { | ||
| checksum: string; | ||
| externals: SharedInfo[]; | ||
| chunks?: ChunkInfo; | ||
| files: string[]; | ||
| } | undefined; | ||
| persist: (payload: { | ||
| checksum: string; | ||
| externals: SharedInfo[]; | ||
| chunks?: ChunkInfo; | ||
| files: string[]; | ||
| }) => void; | ||
| copyFiles: (fullOutputPath: string) => void; | ||
| clear: () => void; | ||
| }; |
| import path from 'path'; | ||
| import fs from 'fs'; | ||
| import crypto from 'crypto'; | ||
| import { logger } from './logger.js'; | ||
| export const getDefaultCachePath = (workspaceRoot) => path.join(workspaceRoot, 'node_modules/.cache/native-federation'); | ||
| export const getFilename = (title, dev) => { | ||
| const devSuffix = dev ? '-dev' : ''; | ||
| return `${title}${devSuffix}.meta.json`; | ||
| }; | ||
| export const getChecksum = (shared, dev) => { | ||
| const denseExternals = Object.keys(shared) | ||
| .sort() | ||
| .reduce((clean, external) => { | ||
| return (clean + ':' + external + (shared[external].version ? `@${shared[external].version}` : '')); | ||
| }, 'deps'); | ||
| return crypto | ||
| .createHash('sha256') | ||
| .update(denseExternals + `:dev=${dev}`) | ||
| .digest('hex'); | ||
| }; | ||
| export const cacheEntry = (pathToCache, fileName) => ({ | ||
| getMetadata: (checksum) => { | ||
| const metadataFile = path.join(pathToCache, fileName); | ||
| if (!fs.existsSync(pathToCache) || !fs.existsSync(metadataFile)) | ||
| return undefined; | ||
| const cachedResult = JSON.parse(fs.readFileSync(metadataFile, 'utf-8')); | ||
| if (cachedResult.checksum !== checksum) | ||
| return undefined; | ||
| return cachedResult; | ||
| }, | ||
| persist: (payload) => { | ||
| fs.writeFileSync(path.join(pathToCache, fileName), JSON.stringify(payload), 'utf-8'); | ||
| }, | ||
| copyFiles: (fullOutputPath) => { | ||
| const metadataFile = path.join(pathToCache, fileName); | ||
| if (!fs.existsSync(metadataFile)) | ||
| throw new Error('Error copying artifacts to dist, metadata file could not be found.'); | ||
| const cachedResult = JSON.parse(fs.readFileSync(metadataFile, 'utf-8')); | ||
| fs.mkdirSync(path.dirname(fullOutputPath), { recursive: true }); | ||
| cachedResult.files.forEach(file => { | ||
| const cachedFile = path.join(pathToCache, file); | ||
| const distFileName = path.join(fullOutputPath, file); | ||
| if (fs.existsSync(cachedFile)) { | ||
| fs.copyFileSync(cachedFile, distFileName); | ||
| } | ||
| }); | ||
| }, | ||
| clear: () => { | ||
| const metadataFile = path.join(pathToCache, fileName); | ||
| if (!fs.existsSync(pathToCache)) { | ||
| fs.mkdirSync(pathToCache, { recursive: true }); | ||
| logger.debug(`Creating cache folder '${pathToCache}' for '${fileName}'.`); | ||
| return; | ||
| } | ||
| if (!fs.existsSync(metadataFile)) | ||
| return; | ||
| logger.debug(`Purging cached bundle '${metadataFile}'.`); | ||
| const cachedResult = JSON.parse(fs.readFileSync(metadataFile, 'utf-8')); | ||
| cachedResult.files.forEach(file => { | ||
| const cachedFile = path.join(pathToCache, file); | ||
| if (fs.existsSync(cachedFile)) | ||
| fs.unlinkSync(cachedFile); | ||
| }); | ||
| fs.unlinkSync(metadataFile); | ||
| }, | ||
| }); |
| import { type PathToImport } from '../domain/utils/mapped-path.contract.js'; | ||
| import { type UsedDependencies } from '../domain/utils/used-dependencies.contract.js'; | ||
| export declare function getUsedDependenciesFactory(workspaceRoot: string, fallbackEntryPoints?: string[]): (config: { | ||
| name?: string; | ||
| exposes?: Record<string, string>; | ||
| sharedMappings: PathToImport; | ||
| }) => UsedDependencies; |
| import { getProjectData } from '@softarc/sheriff-core'; | ||
| import { cwd } from 'process'; | ||
| import { getPackageInfo } from './package-info.js'; | ||
| import { getExternalImports as extractExternalImports } from './get-external-imports.js'; | ||
| import * as path from 'path'; | ||
| export function getUsedDependenciesFactory(workspaceRoot, fallbackEntryPoints) { | ||
| return config => { | ||
| let entryPoints = Object.values(config.exposes ?? {}); | ||
| if (entryPoints.length < 1) | ||
| entryPoints = fallbackEntryPoints; | ||
| if (!entryPoints || entryPoints.length < 1) | ||
| 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.'); | ||
| const fileInfos = Object.values(entryPoints ?? []).reduce((acc, entryPoint) => ({ | ||
| ...acc, | ||
| ...getProjectData(entryPoint, cwd(), { | ||
| includeExternalLibraries: true, | ||
| }), | ||
| }), {}); | ||
| const usedPackageNames = new Set(); | ||
| for (const fileInfo of Object.values(fileInfos)) { | ||
| for (const pckg of [ | ||
| ...(fileInfo?.externalLibraries || []), | ||
| ...(fileInfo?.unresolvedImports || []), | ||
| ]) { | ||
| usedPackageNames.add(pckg); | ||
| } | ||
| } | ||
| return { | ||
| external: addTransientDeps(usedPackageNames, workspaceRoot), | ||
| internal: resolveUsedMappings(fileInfos, workspaceRoot, config.sharedMappings), | ||
| }; | ||
| }; | ||
| } | ||
| function addTransientDeps(packages, workspaceRoot) { | ||
| const packagesAndPeers = new Set([...packages]); | ||
| const discovered = new Set(packagesAndPeers); | ||
| const stack = [...packagesAndPeers]; | ||
| while (stack.length > 0) { | ||
| const dep = stack.pop(); | ||
| if (!dep) { | ||
| continue; | ||
| } | ||
| const pInfo = getPackageInfo(dep, workspaceRoot); | ||
| if (!pInfo) { | ||
| continue; | ||
| } | ||
| const peerDeps = extractExternalImports(pInfo.entryPoint); | ||
| for (const peerDep of peerDeps) { | ||
| if (!discovered.has(peerDep)) { | ||
| discovered.add(peerDep); | ||
| stack.push(peerDep); | ||
| packagesAndPeers.add(peerDep); | ||
| } | ||
| } | ||
| } | ||
| return packagesAndPeers; | ||
| } | ||
| function resolveUsedMappings(fileInfos, workspaceRoot, sharedMappings) { | ||
| const usedMappings = {}; | ||
| for (const fileName of Object.keys(fileInfos)) { | ||
| const fullFileName = path.join(workspaceRoot, fileName); | ||
| if (isSharedMapping(fullFileName, sharedMappings)) | ||
| continue; | ||
| const fileInfo = fileInfos[fileName]; | ||
| if (!fileInfo) | ||
| continue; | ||
| // Check if any of this file's imports land in a shared mapping | ||
| for (const imp of fileInfo.imports ?? []) { | ||
| const fullImport = path.join(workspaceRoot, imp); | ||
| const match = matchMapping(fullImport, sharedMappings); | ||
| if (match) | ||
| usedMappings[fullImport] = match; | ||
| } | ||
| } | ||
| return usedMappings; | ||
| } | ||
| function isSharedMapping(filePath, sharedMappings) { | ||
| for (const sharedPath of Object.keys(sharedMappings)) { | ||
| const asteriskIndex = sharedPath.indexOf('*'); | ||
| if (asteriskIndex !== -1) { | ||
| const prefix = sharedPath.substring(0, asteriskIndex); | ||
| if (filePath.startsWith(prefix)) | ||
| return true; | ||
| } | ||
| else if (filePath.startsWith(sharedPath + path.sep) || filePath === sharedPath) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| function matchMapping(filePath, sharedMappings) { | ||
| for (const [sharedPath, sharedImport] of Object.entries(sharedMappings)) { | ||
| const asteriskIndex = sharedPath.indexOf('*'); | ||
| if (asteriskIndex !== -1) { | ||
| const prefix = sharedPath.substring(0, asteriskIndex); | ||
| const suffix = sharedPath.substring(asteriskIndex + 1); | ||
| if (!filePath.startsWith(prefix)) | ||
| continue; | ||
| if (suffix && !filePath.includes(suffix)) | ||
| continue; | ||
| const captured = suffix | ||
| ? filePath.slice(prefix.length, filePath.indexOf(suffix, prefix.length)) | ||
| : filePath.slice(prefix.length); | ||
| return sharedImport.replace('*', toImportPath(captured)); | ||
| } | ||
| else if (filePath === sharedPath || isIndexOf(filePath, sharedPath)) { | ||
| return sharedImport; | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| /** | ||
| * Detect if it's a barrel file which is inferred by typescript | ||
| */ | ||
| const INDEX_PATTERN = /\/index\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/; | ||
| function isIndexOf(filePath, dirPath) { | ||
| return filePath.startsWith(dirPath + path.sep) && INDEX_PATTERN.test(filePath); | ||
| } | ||
| function toImportPath(filePath) { | ||
| const withoutExt = filePath.replace(/\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/, ''); | ||
| const normalized = withoutExt.replace(/\\/g, '/'); | ||
| return normalized.endsWith('/index') ? normalized.slice(0, -6) : normalized; | ||
| } |
+2
-2
| { | ||
| "name": "@softarc/native-federation", | ||
| "version": "4.0.0-RC1", | ||
| "version": "4.0.0-RC10", | ||
| "type": "module", | ||
@@ -11,3 +11,3 @@ "license": "MIT", | ||
| "json5": "^2.2.3", | ||
| "esbuild": "^0.19.2" | ||
| "esbuild": "^0.28.0" | ||
| }, | ||
@@ -14,0 +14,0 @@ "exports": { |
+0
-1
@@ -5,2 +5,1 @@ export * from './lib/domain/config/index.js'; | ||
| export { DEFAULT_SKIP_LIST } from './lib/config/default-skip-list.js'; | ||
| //# sourceMappingURL=config.d.ts.map |
+0
-1
| export * from './lib/domain/config/index.js'; | ||
| export * from './lib/domain/core/index.js'; | ||
| //# sourceMappingURL=domain.d.ts.map |
+3
-2
| export { setBuildAdapter } from './lib/core/build-adapter.js'; | ||
| export { buildForFederation } from './lib/core/build-for-federation.js'; | ||
| export { rebuildForFederation } from './lib/core/rebuild-for-federation.js'; | ||
| export { createFederationCache } from './lib/core/federation-cache.js'; | ||
| export { bundleExposedAndMappings } from './lib/core/bundle-exposed-and-mappings.js'; | ||
| export { getExternals } from './lib/core/get-externals.js'; | ||
| export { loadFederationConfig } from './lib/core/load-federation-config.js'; | ||
| export { normalizeFederationOptions } from './lib/core/normalize-options.js'; | ||
| export { writeFederationInfo } from './lib/core/write-federation-info.js'; | ||
| export { type BuildHelperParams, federationBuilder } from './lib/core/federation-builder.js'; | ||
| export * from './domain.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
+3
-1
| export { setBuildAdapter } from './lib/core/build-adapter.js'; | ||
| export { buildForFederation } from './lib/core/build-for-federation.js'; | ||
| export { rebuildForFederation } from './lib/core/rebuild-for-federation.js'; | ||
| export { createFederationCache } from './lib/core/federation-cache.js'; | ||
| export { bundleExposedAndMappings } from './lib/core/bundle-exposed-and-mappings.js'; | ||
| export { getExternals } from './lib/core/get-externals.js'; | ||
| export { loadFederationConfig } from './lib/core/load-federation-config.js'; | ||
| export { normalizeFederationOptions } from './lib/core/normalize-options.js'; | ||
| export { writeFederationInfo } from './lib/core/write-federation-info.js'; | ||
| export { federationBuilder } from './lib/core/federation-builder.js'; | ||
| export * from './domain.js'; |
@@ -5,9 +5,10 @@ export * from './lib/utils/build-result-map.js'; | ||
| export { logger, setLogLevel } from './lib/utils/logger.js'; | ||
| export type { MappedPath } from './lib/domain/utils/mapped-path.contract.js'; | ||
| export { RebuildQueue } from './lib/utils/rebuild-queue.js'; | ||
| export type { PathToImport } from './lib/domain/utils/mapped-path.contract.js'; | ||
| export { RebuildQueue, type TrackResult } from './lib/utils/rebuild-queue.js'; | ||
| export { AbortedError } from './lib/utils/errors.js'; | ||
| export { createBuildResultMap, lookupInResultMap } from './lib/utils/build-result-map.js'; | ||
| export { createBuildResultMap, lookupInResultMap, popFromResultMap, } from './lib/utils/build-result-map.js'; | ||
| export { writeImportMap } from './lib/core/write-import-map.js'; | ||
| export type { NormalizedExternalConfig, NormalizedSharedExternalsConfig, } from './lib/domain/config/external-config.contract.js'; | ||
| export type { NormalizedFederationConfig } from './lib/domain/config/federation-config.contract.js'; | ||
| //# sourceMappingURL=internal.d.ts.map | ||
| export { getDefaultCachePath, getChecksum } from './lib/utils/cache-persistence.js'; | ||
| export { isInSkipList, prepareSkipList } from './lib/config/default-skip-list.js'; |
+3
-1
@@ -7,3 +7,5 @@ export * from './lib/utils/build-result-map.js'; | ||
| export { AbortedError } from './lib/utils/errors.js'; | ||
| export { createBuildResultMap, lookupInResultMap } from './lib/utils/build-result-map.js'; | ||
| export { createBuildResultMap, lookupInResultMap, popFromResultMap, } from './lib/utils/build-result-map.js'; | ||
| export { writeImportMap } from './lib/core/write-import-map.js'; | ||
| export { getDefaultCachePath, getChecksum } from './lib/utils/cache-persistence.js'; | ||
| export { isInSkipList, prepareSkipList } from './lib/config/default-skip-list.js'; |
@@ -8,2 +8,1 @@ export interface ConfigurationContext { | ||
| export declare function getConfigContext(): ConfigurationContext; | ||
| //# sourceMappingURL=configuration-context.d.ts.map |
@@ -5,2 +5,1 @@ import type { PreparedSkipList, SkipList } from '../domain/config/skip-list.contract.js'; | ||
| export declare function isInSkipList(entry: string, skipList: PreparedSkipList): boolean; | ||
| //# sourceMappingURL=default-skip-list.d.ts.map |
| export const DEFAULT_SKIP_LIST = [ | ||
| '@softarc/native-federation-runtime', | ||
| '@softarc/native-federation', | ||
@@ -7,19 +6,8 @@ '@softarc/native-federation-core', | ||
| '@softarc/native-federation-esbuild', | ||
| '@angular-architects/native-federation', | ||
| '@angular-architects/native-federation-runtime', | ||
| '@softarc/native-federation-runtime', | ||
| '@softarc/native-federation-orchestrator', | ||
| 'vanilla-native-federation', | ||
| 'es-module-shims', | ||
| 'zone.js', | ||
| 'tslib/', | ||
| '@angular/localize', | ||
| '@angular/localize/init', | ||
| '@angular/localize/tools', | ||
| // '@angular/platform-server', | ||
| // '@angular/platform-server/init', | ||
| // '@angular/ssr', | ||
| /\/schematics(\/|$)/, | ||
| /^@nx\/angular/, | ||
| pkg => pkg.startsWith('@angular/') && !!pkg.match(/\/testing(\/|$)/), | ||
| pkg => pkg.startsWith('@types/'), | ||
| 'express', | ||
| // (pkg) => pkg.startsWith('@angular/common/locales'), | ||
| ]; | ||
@@ -26,0 +14,0 @@ export function prepareSkipList(skipList) { |
| import { type SkipList } from '../domain/config/skip-list.contract.js'; | ||
| import type { ShareAllExternalsOptions, ShareExternalsOptions } from '../domain/config/external-config.contract.js'; | ||
| export declare const DEFAULT_SECONDARIES_SKIP_LIST: string[]; | ||
| export declare function findRootTsConfigJson(): string; | ||
@@ -12,2 +11,1 @@ export declare function shareAll(config: ShareAllExternalsOptions, opts?: { | ||
| export declare function share(configuredShareObjects: ShareExternalsOptions, projectPath?: string, skipList?: SkipList): ShareExternalsOptions; | ||
| //# sourceMappingURL=share-utils.d.ts.map |
@@ -8,5 +8,4 @@ import * as path from 'path'; | ||
| import { logger } from '../utils/logger.js'; | ||
| import { resolveWildcardKeys } from '../utils/resolve-wildcard-keys.js'; | ||
| import { resolvePackageJsonExportsWildcard } from '../utils/resolve-wildcard-keys.js'; | ||
| let inferVersion = false; | ||
| export const DEFAULT_SECONDARIES_SKIP_LIST = ['@angular/router/upgrade', '@angular/common/upgrade']; | ||
| export function findRootTsConfigJson() { | ||
@@ -53,5 +52,2 @@ const packageJson = findPackageJson(cwd()); | ||
| } | ||
| if (key.toLowerCase() === '@angular-architects/module-federation-runtime') { | ||
| key = '@angular-architects/module-federation'; | ||
| } | ||
| if (!versions[key]) { | ||
@@ -87,3 +83,3 @@ return null; | ||
| function getSecondaries(includeSecondaries, libPath, key, shareObject, preparedSkipList) { | ||
| let exclude = [...DEFAULT_SECONDARIES_SKIP_LIST]; | ||
| let exclude = []; | ||
| let resolveGlob = false; | ||
@@ -172,3 +168,3 @@ if (typeof includeSecondaries === 'object') { | ||
| return items; | ||
| const expanded = resolveWildcardKeys(key, entry, libPath); | ||
| const expanded = resolvePackageJsonExportsWildcard(key, entry, libPath); | ||
| items = expanded | ||
@@ -228,6 +224,6 @@ .map(e => ({ | ||
| const sharedExternals = {}; | ||
| const preparedSkipList = prepareSkipList(opts.skipList ?? DEFAULT_SKIP_LIST); | ||
| const skipList = opts.skipList ?? DEFAULT_SKIP_LIST; | ||
| for (const versions of versionMaps) { | ||
| for (const key in versions) { | ||
| if (isInSkipList(key, preparedSkipList)) { | ||
| if (isInSkipList(key, prepareSkipList(skipList))) { | ||
| continue; | ||
@@ -246,6 +242,4 @@ } | ||
| return { | ||
| ...share(sharedExternals, opts.projectPath, opts.skipList ?? DEFAULT_SKIP_LIST), | ||
| ...(!opts.overrides | ||
| ? {} | ||
| : share(opts.overrides, opts.projectPath, opts.skipList ?? DEFAULT_SKIP_LIST)), | ||
| ...share(sharedExternals, opts.projectPath, skipList), | ||
| ...(!opts.overrides ? {} : share(opts.overrides, opts.projectPath, skipList)), | ||
| }; | ||
@@ -252,0 +246,0 @@ } |
| import type { FederationConfig, NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| export declare function withNativeFederation(config: FederationConfig): NormalizedFederationConfig; | ||
| //# sourceMappingURL=with-native-federation.d.ts.map |
@@ -1,13 +0,15 @@ | ||
| import { getMappedPaths } from '../utils/mapped-paths.js'; | ||
| import { getRawMappedPaths } from '../utils/mapped-paths.js'; | ||
| import { shareAll, findRootTsConfigJson } from './share-utils.js'; | ||
| import { isInSkipList, prepareSkipList } from './default-skip-list.js'; | ||
| import { logger } from '../utils/logger.js'; | ||
| import { DEFAULT_SERVER_DEPS_LIST } from '../core/default-server-deps-list.js'; | ||
| export function withNativeFederation(config) { | ||
| const skip = prepareSkipList(config.skip ?? []); | ||
| const chunks = config.chunks ?? true; | ||
| const normalized = { | ||
| $type: 'classic', | ||
| name: config.name ?? '', | ||
| exposes: config.exposes ?? {}, | ||
| shared: normalizeShared(config, skip), | ||
| sharedMappings: normalizeSharedMappings(config, skip), | ||
| shared: normalizeShared(config, skip, chunks), | ||
| sharedMappings: removeSkippedMappings(config, skip), | ||
| chunks, | ||
| skip, | ||
@@ -17,24 +19,13 @@ externals: config.externals ?? [], | ||
| mappingVersion: config.features?.mappingVersion ?? false, | ||
| ignoreUnusedDeps: config.features?.ignoreUnusedDeps ?? false, | ||
| ignoreUnusedDeps: config.features?.ignoreUnusedDeps ?? true, | ||
| denseChunking: config.features?.denseChunking ?? false, | ||
| }, | ||
| ...(config.shareScope && { shareScope: config.shareScope }), | ||
| }; | ||
| // This is for being backwards compatible | ||
| if (!normalized.features.ignoreUnusedDeps) { | ||
| normalized.shared = filterShared(normalized.shared); | ||
| } | ||
| return normalized; | ||
| } | ||
| function filterShared(shared) { | ||
| const keys = Object.keys(shared).filter(k => !k.startsWith('@angular/common/locales')); | ||
| const filtered = keys.reduce((acc, curr) => ({ | ||
| ...acc, | ||
| [curr]: shared[curr], | ||
| }), {}); | ||
| return filtered; | ||
| } | ||
| function normalizeShared(config, skip) { | ||
| function normalizeShared(config, skip, chunks) { | ||
| let result = {}; | ||
| const shared = config.shared; | ||
| if (!shared) { | ||
| result = shareAll({ | ||
| const shared = config.shared ?? | ||
| shareAll({ | ||
| singleton: true, | ||
@@ -45,46 +36,37 @@ strictVersion: true, | ||
| }); | ||
| } | ||
| else { | ||
| result = Object.keys(shared).reduce((acc, cur) => ({ | ||
| result = Object.keys(shared).reduce((acc, cur) => { | ||
| const key = cur.replace(/\\/g, '/'); | ||
| const sharedConfig = shared[cur]; | ||
| if (!!sharedConfig.chunks && !sharedConfig.build && sharedConfig.chunks !== chunks) { | ||
| logger.warn(`External '${cur}' has explicit chunk settings, consider switching build type to { build: 'package' }.`); | ||
| sharedConfig.chunks = chunks; | ||
| } | ||
| const normalizedConfig = { | ||
| requiredVersion: sharedConfig.requiredVersion ?? 'auto', | ||
| singleton: sharedConfig.singleton ?? false, | ||
| strictVersion: sharedConfig.strictVersion ?? false, | ||
| version: sharedConfig.version, | ||
| chunks: sharedConfig.chunks ?? chunks, | ||
| includeSecondaries: sharedConfig.includeSecondaries, | ||
| packageInfo: sharedConfig.packageInfo, | ||
| platform: sharedConfig.platform ?? config.platform ?? 'browser', | ||
| build: sharedConfig.build ?? 'default', | ||
| ...(sharedConfig.shareScope && { shareScope: sharedConfig.shareScope }), | ||
| }; | ||
| return { | ||
| ...acc, | ||
| [cur.replace(/\\/g, '/')]: { | ||
| requiredVersion: shared[cur].requiredVersion ?? 'auto', | ||
| singleton: shared[cur].singleton ?? false, | ||
| strictVersion: shared[cur].strictVersion ?? false, | ||
| version: shared[cur].version, | ||
| includeSecondaries: shared[cur].includeSecondaries, | ||
| packageInfo: shared[cur].packageInfo, | ||
| platform: shared[cur].platform ?? getDefaultPlatform(cur), | ||
| build: shared[cur].build ?? 'default', | ||
| }, | ||
| }), {}); | ||
| //result = share(result) as Record<string, NormalizedSharedConfig>; | ||
| } | ||
| [key]: normalizedConfig, | ||
| }; | ||
| }, {}); | ||
| result = Object.keys(result) | ||
| .filter(key => !isInSkipList(key, skip)) | ||
| .reduce((acc, cur) => ({ | ||
| ...acc, | ||
| [cur]: result[cur], | ||
| }), {}); | ||
| .reduce((acc, cur) => ({ ...acc, [cur]: result[cur] }), {}); | ||
| return result; | ||
| } | ||
| function normalizeSharedMappings(config, skip) { | ||
| function removeSkippedMappings(config, skipList) { | ||
| const rootTsConfigPath = findRootTsConfigJson(); | ||
| const paths = getMappedPaths({ | ||
| rootTsConfigPath, | ||
| sharedMappings: config.sharedMappings, | ||
| }); | ||
| const result = paths.filter(p => !isInSkipList(p.key, skip) && !p.key.includes('*')); | ||
| if (paths.find(p => p.key.includes('*'))) { | ||
| logger.warn('Sharing mapped paths with wildcards (*) not supported'); | ||
| } | ||
| return result; | ||
| const paths = getRawMappedPaths(rootTsConfigPath, config.sharedMappings); | ||
| return Object.entries(paths) | ||
| .filter(([, _import]) => !isInSkipList(_import, skipList)) | ||
| .reduce((acc, [_path, _import]) => ({ ...acc, [_path]: _import }), {}); | ||
| } | ||
| function getDefaultPlatform(cur) { | ||
| if (DEFAULT_SERVER_DEPS_LIST.find(e => cur.startsWith(e))) { | ||
| return 'node'; | ||
| } | ||
| else { | ||
| return 'browser'; | ||
| } | ||
| } |
| import type { NFBuildAdapter } from '../domain/core/build-adapter.contract.js'; | ||
| export declare function setBuildAdapter(buildAdapter: NFBuildAdapter): void; | ||
| export declare function getBuildAdapter(): NFBuildAdapter; | ||
| //# sourceMappingURL=build-adapter.d.ts.map |
| import { logger } from '../utils/logger.js'; | ||
| let _buildAdapter = async () => { | ||
| // TODO: add logger | ||
| logger.error('NF is missing a build adapter!'); | ||
| return []; | ||
| }; | ||
| let _buildAdapter = null; | ||
| export function setBuildAdapter(buildAdapter) { | ||
@@ -11,3 +7,7 @@ _buildAdapter = buildAdapter; | ||
| export function getBuildAdapter() { | ||
| if (!_buildAdapter) { | ||
| logger.error('Please set a BuildAdapter!'); | ||
| throw new Error('BuildAdapter not set'); | ||
| } | ||
| return _buildAdapter; | ||
| } |
| import type { FederationInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { FederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| import type { NormalizedFederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| import type { BuildParams } from '../domain/core/build-params.contract.js'; | ||
| export declare const defaultBuildParams: BuildParams; | ||
| export declare function buildForFederation(config: NormalizedFederationConfig, fedOptions: FederationOptions, externals: string[], buildParams?: BuildParams): Promise<FederationInfo>; | ||
| //# sourceMappingURL=build-for-federation.d.ts.map | ||
| export declare function buildForFederation(config: NormalizedFederationConfig, fedOptions: NormalizedFederationOptions, externals: string[], signal?: AbortSignal): Promise<FederationInfo>; |
@@ -6,38 +6,23 @@ import { bundleExposedAndMappings, describeExposed, describeSharedMappings, } from './bundle-exposed-and-mappings.js'; | ||
| import { logger } from '../utils/logger.js'; | ||
| import { getCachePath } from './../utils/bundle-caching.js'; | ||
| import { normalizePackageName } from '../utils/normalize.js'; | ||
| import { AbortedError } from '../utils/errors.js'; | ||
| export const defaultBuildParams = { | ||
| skipMappingsAndExposed: false, | ||
| skipShared: false, | ||
| }; | ||
| const sharedPackageInfoCache = []; | ||
| export async function buildForFederation(config, fedOptions, externals, buildParams = defaultBuildParams) { | ||
| const signal = buildParams.signal; | ||
| let artefactInfo; | ||
| if (!buildParams.skipMappingsAndExposed) { | ||
| const start = process.hrtime(); | ||
| artefactInfo = await bundleExposedAndMappings(config, fedOptions, externals, signal); | ||
| logger.measure(start, '[build artifacts] - To bundle all mappings and exposed.'); | ||
| if (signal?.aborted) | ||
| throw new AbortedError('[buildForFederation] After exposed-and-mappings bundle'); | ||
| } | ||
| const exposedInfo = !artefactInfo ? describeExposed(config, fedOptions) : artefactInfo.exposes; | ||
| const normalizedCacheFolder = normalizePackageName(config.name); | ||
| if (normalizedCacheFolder.length < 1) { | ||
| logger.warn("Project name in 'federation.config.js' is empty, defaulting to 'shell' cache folder (could collide with other projects in the workspace)."); | ||
| } | ||
| const cacheProjectFolder = normalizedCacheFolder.length < 1 ? 'shell' : normalizedCacheFolder; | ||
| const pathToCache = getCachePath(fedOptions.workspaceRoot, cacheProjectFolder); | ||
| if (!buildParams.skipShared && sharedPackageInfoCache.length > 0) { | ||
| import { addExternalsToCache } from './federation-cache.js'; | ||
| import path from 'path'; | ||
| export async function buildForFederation(config, fedOptions, externals, signal) { | ||
| // 1. Setup | ||
| fedOptions.federationCache.cachePath = path.join(fedOptions.federationCache.cachePath, fedOptions.projectName); | ||
| logger.info('Building federation artifacts'); | ||
| logger.notice("Skip packages you don't want to share in your federation config"); | ||
| // 2. Externals | ||
| if (fedOptions.federationCache.externals.length > 0) { | ||
| logger.info('Checksum matched, re-using cached externals.'); | ||
| } | ||
| if (!buildParams.skipShared && sharedPackageInfoCache.length === 0) { | ||
| if (fedOptions.federationCache.externals.length === 0) { | ||
| const { sharedBrowser, sharedServer, separateBrowser, separateServer } = splitShared(config.shared); | ||
| if (Object.keys(sharedBrowser).length > 0) { | ||
| notifyBundling('browser-shared'); | ||
| logger.info(`Bundling external npm packages with bundle type 'browser-shared'`); | ||
| const start = process.hrtime(); | ||
| const sharedPackageInfoBrowser = await bundleShared(sharedBrowser, config, fedOptions, externals, 'browser', { pathToCache, bundleName: 'browser-shared' }); | ||
| logger.measure(start, '[build artifacts] - To bundle all shared browser externals'); | ||
| sharedPackageInfoCache.push(...sharedPackageInfoBrowser); | ||
| const sharedPackageInfoBrowser = await bundleShared(sharedBrowser, config, fedOptions, externals, { platform: 'browser', bundleName: 'browser-shared', chunks: config.chunks }); | ||
| logger.measure(start, 'Step 2.1) Bundling all shared browser externals'); | ||
| addExternalsToCache(fedOptions.federationCache, sharedPackageInfoBrowser); | ||
| if (signal?.aborted) | ||
@@ -47,7 +32,7 @@ throw new AbortedError('[buildForFederation] After shared-browser bundle'); | ||
| if (Object.keys(sharedServer).length > 0) { | ||
| notifyBundling('browser-shared'); | ||
| logger.info(`Bundling external npm packages with bundle type 'server-shared'`); | ||
| const start = process.hrtime(); | ||
| const sharedPackageInfoServer = await bundleShared(sharedServer, config, fedOptions, externals, 'node', { pathToCache, bundleName: 'node-shared' }); | ||
| logger.measure(start, '[build artifacts] - To bundle all shared node externals'); | ||
| sharedPackageInfoCache.push(...sharedPackageInfoServer); | ||
| const sharedPackageInfoServer = await bundleShared(sharedServer, config, fedOptions, externals, { platform: 'node', bundleName: 'node-shared', chunks: config.chunks }); | ||
| logger.measure(start, 'Step 2.1) Bundling all shared node externals'); | ||
| addExternalsToCache(fedOptions.federationCache, sharedPackageInfoServer); | ||
| if (signal?.aborted) | ||
@@ -57,7 +42,7 @@ throw new AbortedError('[buildForFederation] After shared-node bundle'); | ||
| if (Object.keys(separateBrowser).length > 0) { | ||
| notifyBundling('browser-shared'); | ||
| logger.info(`Bundling external npm packages with bundle type 'browser-separate'`); | ||
| const start = process.hrtime(); | ||
| const separatePackageInfoBrowser = await bundleSeparatePackages(separateBrowser, externals, config, fedOptions, 'browser', pathToCache); | ||
| logger.measure(start, '[build artifacts] - To bundle all separate browser externals'); | ||
| sharedPackageInfoCache.push(...separatePackageInfoBrowser); | ||
| const separatePackageInfoBrowser = await bundleSeparatePackages(separateBrowser, externals, config, fedOptions, { platform: 'browser' }); | ||
| logger.measure(start, 'Step 2.2) Bundling all separate browser external packages'); | ||
| addExternalsToCache(fedOptions.federationCache, separatePackageInfoBrowser); | ||
| if (signal?.aborted) | ||
@@ -67,7 +52,7 @@ throw new AbortedError('[buildForFederation] After separate-browser bundle'); | ||
| if (Object.keys(separateServer).length > 0) { | ||
| notifyBundling('browser-shared'); | ||
| logger.info(`Bundling external npm packages with bundle type 'node-separate'`); | ||
| const start = process.hrtime(); | ||
| const separatePackageInfoServer = await bundleSeparatePackages(separateServer, externals, config, fedOptions, 'node', pathToCache); | ||
| logger.measure(start, '[build artifacts] - To bundle all separate node externals'); | ||
| sharedPackageInfoCache.push(...separatePackageInfoServer); | ||
| const separatePackageInfoServer = await bundleSeparatePackages(separateServer, externals, config, fedOptions, { platform: 'node' }); | ||
| logger.measure(start, 'Step 2.2) Bundling all separate node external packages'); | ||
| addExternalsToCache(fedOptions.federationCache, separatePackageInfoServer); | ||
| } | ||
@@ -77,6 +62,19 @@ if (signal?.aborted) | ||
| } | ||
| const sharedMappingInfo = !artefactInfo | ||
| // 2. Shared mappings and exposed modules | ||
| const start = process.hrtime(); | ||
| const artifactInfo = await bundleExposedAndMappings(config, fedOptions, externals, undefined, signal); | ||
| logger.measure(start, 'Step 3) Bundling all internal libraries and exposed modules.'); | ||
| if (signal?.aborted) | ||
| throw new AbortedError('[buildForFederation] After exposed-and-mappings bundle'); | ||
| const exposedInfo = !artifactInfo ? describeExposed(config, fedOptions) : artifactInfo.exposes; | ||
| const sharedMappingInfo = !artifactInfo | ||
| ? describeSharedMappings(config, fedOptions) | ||
| : artefactInfo.mappings; | ||
| const sharedInfo = [...sharedPackageInfoCache, ...sharedMappingInfo]; | ||
| : artifactInfo.mappings; | ||
| const sharedExternals = [...fedOptions.federationCache.externals, ...sharedMappingInfo]; | ||
| if (config?.shareScope) { | ||
| Object.values(sharedExternals).forEach(external => { | ||
| if (!external.shareScope) | ||
| external.shareScope = config.shareScope; | ||
| }); | ||
| } | ||
| const buildNotificationsEndpoint = fedOptions.buildNotifications?.enable && fedOptions.dev | ||
@@ -87,8 +85,14 @@ ? fedOptions.buildNotifications?.endpoint | ||
| name: config.name, | ||
| shared: sharedInfo, | ||
| shared: sharedExternals, | ||
| exposes: exposedInfo, | ||
| buildNotificationsEndpoint, | ||
| }; | ||
| if (fedOptions.federationCache.chunks) { | ||
| federationInfo.chunks = fedOptions.federationCache.chunks; | ||
| } | ||
| if (artifactInfo?.chunks) { | ||
| federationInfo.chunks = { ...(federationInfo.chunks ?? {}), ...artifactInfo?.chunks }; | ||
| } | ||
| writeFederationInfo(federationInfo, fedOptions); | ||
| writeImportMap(sharedInfo, fedOptions); | ||
| writeImportMap(fedOptions.federationCache, fedOptions); | ||
| return federationInfo; | ||
@@ -103,3 +107,3 @@ } | ||
| } | ||
| async function bundleSeparatePackages(separateBrowser, externals, config, fedOptions, platform, pathToCache) { | ||
| async function bundleSeparatePackages(separateBrowser, externals, config, fedOptions, buildOptions) { | ||
| const groupedByPackage = {}; | ||
@@ -109,20 +113,25 @@ for (const [key, shared] of Object.entries(separateBrowser)) { | ||
| if (!groupedByPackage[packageName]) { | ||
| groupedByPackage[packageName] = {}; | ||
| groupedByPackage[packageName] = { | ||
| chunks: shared.chunks, | ||
| entries: {}, | ||
| }; | ||
| } | ||
| groupedByPackage[packageName][key] = shared; | ||
| groupedByPackage[packageName].entries[key] = shared; | ||
| } | ||
| const bundlePromises = Object.entries(groupedByPackage).map(async ([packageName, sharedGroup]) => { | ||
| return bundleShared(sharedGroup, config, fedOptions, externals.filter(e => !e.startsWith(packageName)), platform, { | ||
| pathToCache, | ||
| bundleName: `${platform}-${normalizePackageName(packageName)}`, | ||
| const bundlePromises = Object.entries(groupedByPackage).map(async ([packageName, packageConfig]) => { | ||
| return bundleShared(packageConfig.entries, config, fedOptions, externals.filter(e => !e.startsWith(packageName)), { | ||
| platform: buildOptions.platform, | ||
| chunks: packageConfig.chunks, | ||
| bundleName: `${buildOptions.platform}-${normalizePackageName(packageName)}`, | ||
| }); | ||
| }); | ||
| const buildResults = await Promise.all(bundlePromises); | ||
| return buildResults.flat(); | ||
| return buildResults.reduce((acc, r) => { | ||
| let chunks = acc.chunks; | ||
| if (r.chunks) { | ||
| chunks = { ...(acc.chunks ?? {}), ...r.chunks }; | ||
| } | ||
| return { externals: [...acc.externals, ...r.externals], chunks }; | ||
| }, { externals: [] }); | ||
| } | ||
| function notifyBundling(platform) { | ||
| logger.info('Preparing shared npm packages for the platform ' + platform); | ||
| logger.notice('This only needs to be done once, as results are cached'); | ||
| logger.notice("Skip packages you don't want to share in your federation config"); | ||
| } | ||
| function splitShared(shared) { | ||
@@ -129,0 +138,0 @@ const sharedServer = {}; |
@@ -1,7 +0,6 @@ | ||
| import type { ArtefactInfo, ExposesInfo, SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { ArtifactInfo, ExposesInfo, SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| import { type FederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| export declare function bundleExposedAndMappings(config: NormalizedFederationConfig, fedOptions: FederationOptions, externals: string[], signal?: AbortSignal): Promise<ArtefactInfo>; | ||
| export declare function describeExposed(config: NormalizedFederationConfig, options: FederationOptions): Array<ExposesInfo>; | ||
| export declare function describeSharedMappings(config: NormalizedFederationConfig, fedOptions: FederationOptions): Array<SharedInfo>; | ||
| //# sourceMappingURL=bundle-exposed-and-mappings.d.ts.map | ||
| import { type NormalizedFederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| export declare function bundleExposedAndMappings(config: NormalizedFederationConfig, fedOptions: NormalizedFederationOptions, externals: string[], modifiedFiles?: string[], signal?: AbortSignal): Promise<ArtifactInfo>; | ||
| export declare function describeExposed(config: NormalizedFederationConfig, options: NormalizedFederationOptions): Array<ExposesInfo>; | ||
| export declare function describeSharedMappings(config: NormalizedFederationConfig, fedOptions: NormalizedFederationOptions): Array<SharedInfo>; |
| import fs from 'fs'; | ||
| import path from 'path'; | ||
| import { createBuildResultMap, lookupInResultMap } from '../utils/build-result-map.js'; | ||
| import { bundle } from '../utils/build-utils.js'; | ||
| import { createBuildResultMap, popFromResultMap } from '../utils/build-result-map.js'; | ||
| import { logger } from '../utils/logger.js'; | ||
| import { normalize } from '../utils/normalize.js'; | ||
| import { AbortedError } from '../utils/errors.js'; | ||
| export async function bundleExposedAndMappings(config, fedOptions, externals, signal) { | ||
| import { rewriteChunkImports } from '../utils/rewrite-chunk-imports.js'; | ||
| import { getBuildAdapter } from './build-adapter.js'; | ||
| export async function bundleExposedAndMappings(config, fedOptions, externals, modifiedFiles, signal) { | ||
| if (signal?.aborted) { | ||
| throw new AbortedError('[bundle-exposed-and-mappings] Aborted before bundling'); | ||
| } | ||
| const shared = config.sharedMappings.map(sm => { | ||
| const entryPoint = sm.path; | ||
| const tmp = sm.key.replace(/[^A-Za-z0-9]/g, '_'); | ||
| const outFilePath = tmp + '.js'; | ||
| return { fileName: entryPoint, outName: outFilePath, key: sm.key }; | ||
| const shared = Object.entries(config.sharedMappings).map(([entryPoint, mappedImport]) => { | ||
| return { | ||
| fileName: entryPoint, | ||
| outName: mappedImport.replace(/[^A-Za-z0-9]/g, '_') + '.js', | ||
| key: mappedImport, | ||
| }; | ||
| }); | ||
@@ -24,17 +26,23 @@ const exposes = Object.entries(config.exposes).map(([key, entry]) => { | ||
| const hash = !fedOptions.dev; | ||
| logger.info('Building federation artefacts'); | ||
| let result; | ||
| try { | ||
| result = await bundle({ | ||
| entryPoints, | ||
| outdir: fedOptions.outputPath, | ||
| tsConfigPath: fedOptions.tsConfig, | ||
| external: externals, | ||
| dev: !!fedOptions.dev, | ||
| watch: fedOptions.watch, | ||
| mappedPaths: config.sharedMappings, | ||
| kind: 'mapping-or-exposed', | ||
| hash, | ||
| optimizedMappings: config.features.ignoreUnusedDeps, | ||
| if (!modifiedFiles) { | ||
| await getBuildAdapter().setup('mapping-or-exposed', { | ||
| entryPoints, | ||
| outdir: fedOptions.outputPath, | ||
| tsConfigPath: fedOptions.tsConfig, | ||
| external: externals, | ||
| dev: !!fedOptions.dev, | ||
| watch: fedOptions.watch, | ||
| mappedPaths: config.sharedMappings, | ||
| chunks: config.chunks, | ||
| hash, | ||
| optimizedMappings: config.features.ignoreUnusedDeps, | ||
| isMappingOrExposed: true, | ||
| cache: fedOptions.federationCache, | ||
| }); | ||
| } | ||
| result = await getBuildAdapter().build('mapping-or-exposed', { | ||
| signal, | ||
| modifiedFiles, | ||
| }); | ||
@@ -47,3 +55,3 @@ if (signal?.aborted) { | ||
| if (!(error instanceof AbortedError)) { | ||
| logger.error('Error building federation artefacts'); | ||
| logger.error('Error building federation artifacts'); | ||
| } | ||
@@ -54,6 +62,9 @@ throw error; | ||
| const sharedResult = []; | ||
| const entryFiles = []; | ||
| // Pick shared-mappings | ||
| for (const item of shared) { | ||
| const distEntryFile = popFromResultMap(resultMap, item.outName); | ||
| sharedResult.push({ | ||
| packageName: item.key, | ||
| outFileName: lookupInResultMap(resultMap, item.outName), | ||
| outFileName: path.basename(distEntryFile), | ||
| requiredVersion: '', | ||
@@ -69,8 +80,11 @@ singleton: true, | ||
| }); | ||
| entryFiles.push(distEntryFile); | ||
| } | ||
| const exposedResult = []; | ||
| // Pick exposed-modules | ||
| for (const item of exposes) { | ||
| const distEntryFile = popFromResultMap(resultMap, item.outName); | ||
| exposedResult.push({ | ||
| key: item.key, | ||
| outFileName: lookupInResultMap(resultMap, item.outName), | ||
| outFileName: path.basename(distEntryFile), | ||
| dev: !fedOptions.dev | ||
@@ -82,4 +96,18 @@ ? undefined | ||
| }); | ||
| entryFiles.push(distEntryFile); | ||
| } | ||
| return { mappings: sharedResult, exposes: exposedResult }; | ||
| // Remove .map files | ||
| Object.keys(resultMap) | ||
| .filter(f => f.endsWith('.map')) | ||
| .forEach(f => popFromResultMap(resultMap, f)); | ||
| // Process remaining chunks and lazy loaded internal modules | ||
| let exportedChunks = undefined; | ||
| if (config.chunks && config.features.denseChunking) { | ||
| for (const entryFile of entryFiles) | ||
| rewriteChunkImports(entryFile); | ||
| exportedChunks = { | ||
| ['mapping-or-exposed']: Object.values(resultMap).map(chunk => path.basename(chunk)), | ||
| }; | ||
| } | ||
| return { mappings: sharedResult, exposes: exposedResult, chunks: exportedChunks }; | ||
| } | ||
@@ -104,5 +132,5 @@ export function describeExposed(config, options) { | ||
| const result = []; | ||
| for (const m of config.sharedMappings) { | ||
| for (const [mappedPath, mappedImport] of Object.entries(config.sharedMappings)) { | ||
| result.push({ | ||
| packageName: m.key, | ||
| packageName: mappedImport, | ||
| outFileName: '', | ||
@@ -112,7 +140,7 @@ requiredVersion: '', | ||
| strictVersion: false, | ||
| version: config.features.mappingVersion ? getMappingVersion(m.path) : '', | ||
| version: config.features.mappingVersion ? getMappingVersion(mappedPath) : '', | ||
| dev: !fedOptions.dev | ||
| ? undefined | ||
| : { | ||
| entryPoint: normalize(path.normalize(m.path)), | ||
| entryPoint: normalize(path.normalize(mappedPath)), | ||
| }, | ||
@@ -119,0 +147,0 @@ }); |
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| import type { SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| import { type FederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| import { type NormalizedFederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| import type { NormalizedExternalConfig } from '../domain/config/external-config.contract.js'; | ||
| export declare function bundleShared(sharedBundles: Record<string, NormalizedExternalConfig>, config: NormalizedFederationConfig, fedOptions: FederationOptions, externals: string[], platform: "browser" | "node" | undefined, cacheOptions: { | ||
| pathToCache: string; | ||
| export declare function bundleShared(sharedBundles: Record<string, NormalizedExternalConfig>, config: NormalizedFederationConfig, fedOptions: NormalizedFederationOptions, externals: string[], buildOptions: { | ||
| platform: 'browser' | 'node'; | ||
| bundleName: string; | ||
| }): Promise<Array<SharedInfo>>; | ||
| //# sourceMappingURL=bundle-shared.d.ts.map | ||
| chunks: boolean; | ||
| }): Promise<{ | ||
| externals: SharedInfo[]; | ||
| chunks?: Record<string, string[]>; | ||
| }>; |
| import * as path from 'path'; | ||
| import * as fs from 'fs'; | ||
| import { bundle } from '../utils/build-utils.js'; | ||
| import { getPackageInfo } from '../utils/package-info.js'; | ||
@@ -8,6 +7,8 @@ import { logger } from '../utils/logger.js'; | ||
| import { DEFAULT_EXTERNAL_LIST } from './default-external-list.js'; | ||
| import { deriveInternalName, isSourceFile, rewriteChunkImports, } from '../utils/rewrite-chunk-imports.js'; | ||
| import { cacheEntry, getChecksum, getFilename } from './../utils/bundle-caching.js'; | ||
| import { isSourceFile, rewriteChunkImports } from '../utils/rewrite-chunk-imports.js'; | ||
| import { toChunkImport } from '../domain/core/chunk.js'; | ||
| import { cacheEntry, getChecksum, getFilename } from '../utils/cache-persistence.js'; | ||
| import { fileURLToPath } from 'url'; | ||
| export async function bundleShared(sharedBundles, config, fedOptions, externals, platform = 'browser', cacheOptions) { | ||
| import { getBuildAdapter } from './build-adapter.js'; | ||
| export async function bundleShared(sharedBundles, config, fedOptions, externals, buildOptions) { | ||
| const checksum = getChecksum(sharedBundles, fedOptions.dev ? '1' : '0'); | ||
@@ -17,9 +18,9 @@ const folder = fedOptions.packageJson | ||
| : fedOptions.workspaceRoot; | ||
| const bundleCache = cacheEntry(cacheOptions.pathToCache, getFilename(cacheOptions.bundleName, fedOptions.dev)); | ||
| const bundleCache = cacheEntry(fedOptions.federationCache.cachePath, getFilename(buildOptions.bundleName, fedOptions.dev)); | ||
| if (fedOptions?.cacheExternalArtifacts) { | ||
| const cacheMetadata = bundleCache.getMetadata(checksum); | ||
| if (cacheMetadata) { | ||
| logger.debug(`Checksum of ${cacheOptions.bundleName} matched, Skipped artifact bundling`); | ||
| logger.debug(`Checksum of ${buildOptions.bundleName} matched, Skipped artifact bundling`); | ||
| bundleCache.copyFiles(path.join(fedOptions.workspaceRoot, fedOptions.outputPath)); | ||
| return cacheMetadata.externals; | ||
| return { externals: cacheMetadata.externals, chunks: cacheMetadata.chunks }; | ||
| } | ||
@@ -50,23 +51,27 @@ } | ||
| const expectedResults = allEntryPoints.map(ep => path.join(fullOutputPath, ep.outName)); | ||
| const entryPoints = allEntryPoints.filter(ep => !fs.existsSync(path.join(cacheOptions.pathToCache, ep.outName))); | ||
| const entryPoints = allEntryPoints.filter(ep => !fs.existsSync(path.join(fedOptions.federationCache.cachePath, ep.outName))); | ||
| // If we build for the browser and don't remote unused deps from the shared config, | ||
| // we need to exclude typical node libs to avoid compilation issues | ||
| const useDefaultExternalList = platform === 'browser' && !config.features.ignoreUnusedDeps; | ||
| const useDefaultExternalList = buildOptions.platform === 'browser' && !config.features.ignoreUnusedDeps; | ||
| const additionalExternals = useDefaultExternalList ? DEFAULT_EXTERNAL_LIST : []; | ||
| let bundleResult = null; | ||
| try { | ||
| bundleResult = await bundle({ | ||
| await getBuildAdapter().setup(buildOptions.bundleName, { | ||
| entryPoints, | ||
| tsConfigPath: fedOptions.tsConfig, | ||
| external: [...additionalExternals, ...externals], | ||
| outdir: cacheOptions.pathToCache, | ||
| outdir: fedOptions.federationCache.cachePath, | ||
| mappedPaths: config.sharedMappings, | ||
| dev: fedOptions.dev, | ||
| kind: 'shared-package', | ||
| isMappingOrExposed: false, | ||
| hash: false, | ||
| platform, | ||
| chunks: buildOptions.chunks, | ||
| platform: buildOptions.platform, | ||
| optimizedMappings: config.features.ignoreUnusedDeps, | ||
| cache: fedOptions.federationCache, | ||
| }); | ||
| bundleResult = await getBuildAdapter().build(buildOptions.bundleName); | ||
| await getBuildAdapter().dispose(buildOptions.bundleName); | ||
| const cachedFiles = bundleResult.map(br => path.basename(br.fileName)); | ||
| rewriteImports(cachedFiles, cacheOptions.pathToCache); | ||
| rewriteImports(cachedFiles, fedOptions.federationCache.cachePath); | ||
| } | ||
@@ -95,6 +100,19 @@ catch (e) { | ||
| const result = buildResult(packageInfos, sharedBundles, outFileNames); | ||
| // TODO: Decide whether/when to add .map files | ||
| const chunks = bundleResult.filter(br => !br.fileName.endsWith('.map') && | ||
| !result.find(r => r.outFileName === path.basename(br.fileName))); | ||
| addChunksToResult(chunks, result); | ||
| /** | ||
| * Chunking | ||
| */ | ||
| let exportedChunks = undefined; | ||
| if (buildOptions.chunks && config.features.denseChunking) { | ||
| result.forEach(external => { | ||
| external.bundle = buildOptions.bundleName; | ||
| }); | ||
| if (chunks.length > 0) { | ||
| exportedChunks = { [buildOptions.bundleName]: getChunkFileNames(chunks) }; | ||
| } | ||
| } | ||
| else { | ||
| addChunksToResult(chunks, result); | ||
| } | ||
| bundleCache.persist({ | ||
@@ -104,5 +122,6 @@ checksum, | ||
| files: bundleResult.map(r => r.fileName.split(path.sep).pop() ?? r.fileName), | ||
| chunks: exportedChunks, | ||
| }); | ||
| bundleCache.copyFiles(path.join(fedOptions.workspaceRoot, fedOptions.outputPath)); | ||
| return result; | ||
| return { externals: result, chunks: exportedChunks }; | ||
| } | ||
@@ -132,2 +151,3 @@ function rewriteImports(cachedFiles, cachePath) { | ||
| version: pi.version, | ||
| ...(shared?.shareScope && { shareScope: shared.shareScope }), | ||
| // TODO: Decide whether/when we need debug infos | ||
@@ -142,2 +162,5 @@ // dev: !fedOptions.dev | ||
| } | ||
| function getChunkFileNames(chunks) { | ||
| return chunks.map(chunk => path.basename(chunk.fileName)); | ||
| } | ||
| function addChunksToResult(chunks, result) { | ||
@@ -159,3 +182,3 @@ for (const item of chunks) { | ||
| requiredVersion: '0.0.0', | ||
| packageName: deriveInternalName(fileName), | ||
| packageName: toChunkImport(fileName), | ||
| outFileName: fileName, | ||
@@ -162,0 +185,0 @@ // dev: dev |
| export declare const DEFAULT_EXTERNAL_LIST: string[]; | ||
| //# sourceMappingURL=default-external-list.d.ts.map |
@@ -29,5 +29,2 @@ const NODE_PACKAGES = [ | ||
| ]; | ||
| export const DEFAULT_EXTERNAL_LIST = NODE_PACKAGES.flatMap((p) => [ | ||
| p, | ||
| 'node:' + p, | ||
| ]); | ||
| export const DEFAULT_EXTERNAL_LIST = NODE_PACKAGES.flatMap(p => [p, 'node:' + p]); |
@@ -10,6 +10,11 @@ import type { FederationInfo } from '../domain/core/federation-info.contract.js'; | ||
| declare function init(params: BuildHelperParams): Promise<void>; | ||
| declare function build(buildParams?: import("../../domain.js").BuildParams): Promise<void>; | ||
| declare function build(opts?: { | ||
| modifiedFiles?: string[]; | ||
| signal?: AbortSignal; | ||
| }): Promise<void>; | ||
| declare function close(): Promise<void>; | ||
| export declare const federationBuilder: { | ||
| init: typeof init; | ||
| build: typeof build; | ||
| close: typeof close; | ||
| readonly federationInfo: FederationInfo; | ||
@@ -20,2 +25,1 @@ readonly externals: string[]; | ||
| export {}; | ||
| //# sourceMappingURL=federation-builder.d.ts.map |
| import { getConfigContext, usePackageJson, useWorkspace } from '../config/configuration-context.js'; | ||
| import { setBuildAdapter } from './build-adapter.js'; | ||
| import { buildForFederation, defaultBuildParams } from './build-for-federation.js'; | ||
| import { getBuildAdapter, setBuildAdapter } from './build-adapter.js'; | ||
| import { buildForFederation } from './build-for-federation.js'; | ||
| import { getExternals } from './get-externals.js'; | ||
| import { loadFederationConfig } from './load-federation-config.js'; | ||
| import { normalizeFederationOptions } from './normalize-options.js'; | ||
| import { rebuildForFederation } from './rebuild-for-federation.js'; | ||
| let externals = []; | ||
| let config; | ||
| let fedOptions; | ||
| let options; | ||
| let fedInfo; | ||
| async function init(params) { | ||
| setBuildAdapter(params.adapter); | ||
| fedOptions = params.options; | ||
| useWorkspace(params.options.workspaceRoot); | ||
| usePackageJson(params.options.packageJson); | ||
| config = await loadFederationConfig(fedOptions); | ||
| params.options.workspaceRoot = getConfigContext().workspaceRoot ?? params.options.workspaceRoot; | ||
| const normalized = await normalizeFederationOptions(params.options); | ||
| options = normalized.options; | ||
| config = normalized.config; | ||
| externals = getExternals(config); | ||
| } | ||
| async function build(buildParams = defaultBuildParams) { | ||
| fedInfo = await buildForFederation(config, fedOptions, externals, buildParams); | ||
| async function build(opts = {}) { | ||
| if (!fedInfo) { | ||
| fedInfo = await buildForFederation(config, options, externals, opts.signal); | ||
| } | ||
| else { | ||
| fedInfo = await rebuildForFederation(config, options, externals, opts.modifiedFiles ?? [], opts.signal); | ||
| } | ||
| } | ||
| async function close() { | ||
| return getBuildAdapter().dispose(); | ||
| } | ||
| export const federationBuilder = { | ||
| init, | ||
| build, | ||
| close, | ||
| get federationInfo() { | ||
@@ -26,0 +37,0 @@ return fedInfo; |
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| export declare function getExternals(config: NormalizedFederationConfig): string[]; | ||
| //# sourceMappingURL=get-externals.d.ts.map |
| export function getExternals(config) { | ||
| const shared = Object.keys(config.shared); | ||
| const sharedMappings = config.sharedMappings.map(m => m.key); | ||
| const sharedMappings = Object.values(config.sharedMappings); | ||
| const externals = [...shared, ...sharedMappings, ...config.externals]; | ||
| return externals; | ||
| } |
| import type { FederationInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { FederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| export declare function writeFederationInfo(federationInfo: FederationInfo, fedOptions: FederationOptions): void; | ||
| //# sourceMappingURL=write-federation-info.d.ts.map |
@@ -1,4 +0,6 @@ | ||
| import type { SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { ChunkInfo, SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| import type { FederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| export declare function writeImportMap(sharedInfo: SharedInfo[], fedOption: FederationOptions): void; | ||
| //# sourceMappingURL=write-import-map.d.ts.map | ||
| export declare function writeImportMap(sharedInfo: { | ||
| externals: SharedInfo[]; | ||
| chunks?: ChunkInfo; | ||
| }, fedOption: FederationOptions): void; |
| import * as path from 'path'; | ||
| import * as fs from 'fs'; | ||
| import { toChunkImport } from '../domain/core/chunk.js'; | ||
| export function writeImportMap(sharedInfo, fedOption) { | ||
| const imports = sharedInfo.reduce((acc, cur) => { | ||
| const imports = sharedInfo.externals.reduce((acc, cur) => { | ||
| return { | ||
@@ -10,2 +11,10 @@ ...acc, | ||
| }, {}); | ||
| if (sharedInfo.chunks) { | ||
| Object.values(sharedInfo.chunks).forEach(c => { | ||
| c.forEach(e => { | ||
| const key = toChunkImport(e); | ||
| imports[key] = e; | ||
| }); | ||
| }); | ||
| } | ||
| const importMap = { imports }; | ||
@@ -12,0 +21,0 @@ const importMapPath = path.join(fedOption.workspaceRoot, fedOption.outputPath, 'importmap.json'); |
@@ -8,3 +8,5 @@ export interface ExternalConfig { | ||
| platform?: 'browser' | 'node'; | ||
| build?: 'default' | 'separate'; | ||
| build?: 'separate' | 'package'; | ||
| chunks?: boolean; | ||
| shareScope?: string; | ||
| packageInfo?: { | ||
@@ -22,2 +24,4 @@ entryPoint: string; | ||
| includeSecondaries?: boolean; | ||
| shareScope?: string; | ||
| chunks: boolean; | ||
| platform: 'browser' | 'node'; | ||
@@ -42,2 +46,1 @@ build: 'default' | 'separate' | 'package'; | ||
| export type ShareExternalsOptions = Record<string, ShareAllExternalsOptions>; | ||
| //# sourceMappingURL=external-config.contract.d.ts.map |
| import type { PreparedSkipList, SkipList } from './skip-list.contract.js'; | ||
| import type { MappedPath } from '../utils/mapped-path.contract.js'; | ||
| import type { PathToImport } from '../utils/mapped-path.contract.js'; | ||
| import type { NormalizedSharedExternalsConfig, SharedExternalsConfig } from './external-config.contract.js'; | ||
@@ -8,22 +8,29 @@ export interface FederationConfig { | ||
| shared?: SharedExternalsConfig; | ||
| platform?: 'browser' | 'node'; | ||
| sharedMappings?: Array<string>; | ||
| chunks?: boolean; | ||
| skip?: SkipList; | ||
| externals?: string[]; | ||
| shareScope?: string; | ||
| features?: { | ||
| mappingVersion?: boolean; | ||
| ignoreUnusedDeps?: boolean; | ||
| denseChunking?: boolean; | ||
| }; | ||
| } | ||
| export interface NormalizedFederationConfig { | ||
| $type: 'classic'; | ||
| name: string; | ||
| exposes: Record<string, string>; | ||
| shared: NormalizedSharedExternalsConfig; | ||
| sharedMappings: Array<MappedPath>; | ||
| sharedMappings: PathToImport; | ||
| skip: PreparedSkipList; | ||
| chunks: boolean; | ||
| externals: string[]; | ||
| shareScope?: string; | ||
| features: { | ||
| mappingVersion: boolean; | ||
| ignoreUnusedDeps: boolean; | ||
| denseChunking: boolean; | ||
| }; | ||
| } | ||
| //# sourceMappingURL=federation-config.contract.d.ts.map |
| export type { ExternalConfig, IncludeSecondariesOptions, SharedExternalsConfig, ShareAllExternalsOptions, ShareExternalsOptions, } from './external-config.contract.js'; | ||
| export type { FederationConfig } from './federation-config.contract.js'; | ||
| export type { PreparedSkipList, SkipFn, SkipList, SkipListEntry } from './skip-list.contract.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -9,2 +9,1 @@ export type SkipFn = (name: string) => boolean; | ||
| }; | ||
| //# sourceMappingURL=skip-list.contract.d.ts.map |
@@ -1,4 +0,18 @@ | ||
| import type { MappedPath } from '../utils/mapped-path.contract.js'; | ||
| export type NFBuildAdapter = (options: NFBuildAdapterOptions) => Promise<NFBuildAdapterResult[]>; | ||
| export type BuildKind = 'shared-package' | 'shared-mapping' | 'exposed' | 'mapping-or-exposed'; | ||
| import type { PathToImport } from '../utils/mapped-path.contract.js'; | ||
| import type { FederationCache } from './federation-cache.contract.js'; | ||
| export interface NFBuildAdapterContext<TBundlerContext = unknown> { | ||
| ctx: TBundlerContext; | ||
| outdir: string; | ||
| dev: boolean; | ||
| name: string; | ||
| isMappingOrExposed: boolean; | ||
| } | ||
| export interface NFBuildAdapter { | ||
| setup(name: string, options: NFBuildAdapterOptions): Promise<void>; | ||
| build(name: string, opts?: { | ||
| modifiedFiles?: string[]; | ||
| signal?: AbortSignal; | ||
| }): Promise<NFBuildAdapterResult[]>; | ||
| dispose(name?: string): Promise<void>; | ||
| } | ||
| export interface EntryPoint { | ||
@@ -9,17 +23,16 @@ fileName: string; | ||
| } | ||
| export interface NFBuildAdapterOptions { | ||
| export interface NFBuildAdapterOptions<TBundlerCache = unknown> { | ||
| entryPoints: EntryPoint[]; | ||
| tsConfigPath?: string; | ||
| external: Array<string>; | ||
| external: string[]; | ||
| outdir: string; | ||
| mappedPaths: MappedPath[]; | ||
| packageName?: string; | ||
| esm?: boolean; | ||
| mappedPaths: PathToImport; | ||
| isMappingOrExposed: boolean; | ||
| dev?: boolean; | ||
| watch?: boolean; | ||
| kind: BuildKind; | ||
| chunks?: boolean; | ||
| hash: boolean; | ||
| platform?: 'browser' | 'node'; | ||
| optimizedMappings?: boolean; | ||
| signal?: AbortSignal; | ||
| cache: FederationCache<TBundlerCache>; | ||
| } | ||
@@ -29,2 +42,1 @@ export interface NFBuildAdapterResult { | ||
| } | ||
| //# sourceMappingURL=build-adapter.contract.d.ts.map |
@@ -10,2 +10,1 @@ export interface BuildNotificationOptions { | ||
| } | ||
| //# sourceMappingURL=build-notification-options.contract.d.ts.map |
@@ -5,2 +5,3 @@ export interface FederationInfo { | ||
| shared: SharedInfo[]; | ||
| chunks?: Record<string, string[]>; | ||
| buildNotificationsEndpoint?: string; | ||
@@ -14,2 +15,4 @@ } | ||
| packageName: string; | ||
| shareScope?: string; | ||
| bundle?: string; | ||
| outFileName: string; | ||
@@ -20,2 +23,3 @@ dev?: { | ||
| }; | ||
| export type ChunkInfo = Record<string, string[]>; | ||
| export interface ExposesInfo { | ||
@@ -28,6 +32,6 @@ key: string; | ||
| } | ||
| export interface ArtefactInfo { | ||
| export interface ArtifactInfo { | ||
| mappings: SharedInfo[]; | ||
| exposes: ExposesInfo[]; | ||
| chunks?: ChunkInfo; | ||
| } | ||
| //# sourceMappingURL=federation-info.contract.d.ts.map |
| import type { BuildNotificationOptions } from './build-notification-options.contract.js'; | ||
| import type { FederationCache } from './federation-cache.contract.js'; | ||
| export interface FederationOptions { | ||
@@ -6,2 +7,3 @@ workspaceRoot: string; | ||
| federationConfig: string; | ||
| projectName?: string; | ||
| cacheExternalArtifacts?: boolean; | ||
@@ -13,5 +15,9 @@ tsConfig?: string; | ||
| packageJson?: string; | ||
| entryPoint?: string; | ||
| entryPoints?: string[]; | ||
| buildNotifications?: BuildNotificationOptions; | ||
| } | ||
| //# sourceMappingURL=federation-options.contract.d.ts.map | ||
| export interface NormalizedFederationOptions<TBundlerCache = unknown> extends FederationOptions { | ||
| federationCache: FederationCache<TBundlerCache>; | ||
| entryPoints: string[]; | ||
| projectName: string; | ||
| } |
@@ -1,6 +0,6 @@ | ||
| export type { SharedInfo, FederationInfo, ExposesInfo, ArtefactInfo, } from './federation-info.contract.js'; | ||
| export type { SharedInfo, FederationInfo, ExposesInfo, ArtifactInfo, ChunkInfo, } from './federation-info.contract.js'; | ||
| export { type BuildNotificationOptions, BuildNotificationType, } from './build-notification-options.contract.js'; | ||
| export type { FederationOptions } from './federation-options.contract.js'; | ||
| export type { BuildKind, EntryPoint, NFBuildAdapterOptions, NFBuildAdapter, NFBuildAdapterResult, } from './build-adapter.contract.js'; | ||
| export type { BuildParams } from './build-params.contract.js'; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| export type { FederationOptions, NormalizedFederationOptions, } from './federation-options.contract.js'; | ||
| export type { EntryPoint, NFBuildAdapterOptions, NFBuildAdapter, NFBuildAdapterResult, NFBuildAdapterContext, } from './build-adapter.contract.js'; | ||
| export { CHUNK_PREFIX, toChunkImport } from './chunk.js'; | ||
| export type { FederationCache } from './federation-cache.contract.js'; |
| export { BuildNotificationType, } from './build-notification-options.contract.js'; | ||
| export { CHUNK_PREFIX, toChunkImport } from './chunk.js'; |
| export type { KeyValuePair } from './keyvaluepair.contract.js'; | ||
| export type { MappedPath } from './mapped-path.contract.js'; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| export type { PathToImport } from './mapped-path.contract.js'; |
@@ -5,2 +5,1 @@ export type KeyValuePair = { | ||
| }; | ||
| //# sourceMappingURL=keyvaluepair.contract.d.ts.map |
@@ -1,5 +0,1 @@ | ||
| export interface MappedPath { | ||
| key: string; | ||
| path: string; | ||
| } | ||
| //# sourceMappingURL=mapped-path.contract.d.ts.map | ||
| export type PathToImport = Record<string, string>; |
@@ -0,1 +1,5 @@ | ||
| // export interface MappedPath { | ||
| // key: string; | ||
| // path: string; | ||
| // } | ||
| export {}; |
| import type { NFBuildAdapterResult } from '../domain/core/build-adapter.contract.js'; | ||
| export declare function createBuildResultMap(buildResult: NFBuildAdapterResult[], isHashed: boolean): Record<string, string>; | ||
| export declare function lookupInResultMap(map: Record<string, string>, requestName: string): string; | ||
| //# sourceMappingURL=build-result-map.d.ts.map | ||
| export declare function popFromResultMap(map: Record<string, string>, requestName: string): string; |
@@ -14,3 +14,3 @@ import path from 'path'; | ||
| } | ||
| map[requestName] = resultName; | ||
| map[requestName] = item.fileName; | ||
| } | ||
@@ -21,3 +21,10 @@ return map; | ||
| const key = path.basename(requestName); | ||
| return map[key]; | ||
| // path.basename is to maintain backwards compatible | ||
| return path.basename(map[key]); | ||
| } | ||
| export function popFromResultMap(map, requestName) { | ||
| const key = path.basename(requestName); | ||
| const out = map[key]; | ||
| delete map[key]; | ||
| return out; | ||
| } |
| export declare class AbortedError extends Error { | ||
| constructor(message: string); | ||
| } | ||
| //# sourceMappingURL=errors.d.ts.map |
| export declare function getExternalImports(entryFilePath: string): string[]; | ||
| //# sourceMappingURL=get-external-imports.d.ts.map |
| export declare function hashFile(fileName: string): string; | ||
| //# sourceMappingURL=hash-file.d.ts.map |
@@ -11,2 +11,1 @@ export declare const logger: { | ||
| export declare const setLogLevel: (level: string) => void; | ||
| //# sourceMappingURL=logger.d.ts.map |
@@ -1,8 +0,7 @@ | ||
| import type { MappedPath } from '../domain/utils/mapped-path.contract.js'; | ||
| export interface GetMappedPathsOptions { | ||
| rootTsConfigPath: string; | ||
| sharedMappings?: string[]; | ||
| rootPath?: string; | ||
| } | ||
| export declare function getMappedPaths({ rootTsConfigPath, sharedMappings, rootPath, }: GetMappedPathsOptions): Array<MappedPath>; | ||
| //# sourceMappingURL=mapped-paths.d.ts.map | ||
| import type { PathToImport } from '../domain/utils/mapped-path.contract.js'; | ||
| /** | ||
| * Will return user defined and tsconfig defined paths including their imports, might contain wildcards | ||
| * @param param0 | ||
| * @returns | ||
| */ | ||
| export declare function getRawMappedPaths(rootTsConfigPath: string, configuredSharedMappings?: string[], rootPath?: string): PathToImport; |
| import * as path from 'path'; | ||
| import * as fs from 'fs'; | ||
| import JSON5 from 'json5'; | ||
| export function getMappedPaths({ rootTsConfigPath, sharedMappings, rootPath, }) { | ||
| const result = []; | ||
| /** | ||
| * Will return user defined and tsconfig defined paths including their imports, might contain wildcards | ||
| * @param param0 | ||
| * @returns | ||
| */ | ||
| export function getRawMappedPaths(rootTsConfigPath, configuredSharedMappings, rootPath) { | ||
| const mappedPaths = {}; | ||
| if (!path.isAbsolute(rootTsConfigPath)) { | ||
@@ -12,5 +17,5 @@ throw new Error('SharedMappings.register: tsConfigPath needs to be an absolute path!'); | ||
| } | ||
| const shareAll = !sharedMappings; | ||
| if (!sharedMappings) { | ||
| sharedMappings = []; | ||
| const shareAll = !configuredSharedMappings; | ||
| if (!configuredSharedMappings) { | ||
| configuredSharedMappings = []; | ||
| } | ||
@@ -20,14 +25,11 @@ const tsConfig = JSON5.parse(fs.readFileSync(rootTsConfigPath, { encoding: 'utf-8' })); | ||
| if (!mappings) { | ||
| return result; | ||
| return mappedPaths; | ||
| } | ||
| for (const key in mappings) { | ||
| const libPath = path.normalize(path.join(rootPath, mappings[key][0])); | ||
| if (sharedMappings.includes(key) || shareAll) { | ||
| result.push({ | ||
| key, | ||
| path: libPath, | ||
| }); | ||
| if (configuredSharedMappings.includes(key) || shareAll) { | ||
| mappedPaths[libPath] = key; | ||
| } | ||
| } | ||
| return result; | ||
| return mappedPaths; | ||
| } |
| export declare function normalize(path: string, trailingSlash?: boolean): string; | ||
| export declare function normalizePackageName(fileName: string): string; | ||
| //# sourceMappingURL=normalize.d.ts.map |
@@ -31,2 +31,1 @@ export interface PackageInfo { | ||
| export declare function _getPackageInfo(packageName: string, directory: string): PackageInfo | null; | ||
| //# sourceMappingURL=package-info.d.ts.map |
@@ -0,7 +1,19 @@ | ||
| export type TrackResult<T = never> = { | ||
| type: 'completed'; | ||
| result: { | ||
| success: boolean; | ||
| cancelled?: boolean; | ||
| }; | ||
| } | { | ||
| type: 'interrupted'; | ||
| value: T; | ||
| }; | ||
| export declare class RebuildQueue { | ||
| private activeBuilds; | ||
| private buildCounter; | ||
| enqueue(rebuildFn: (signal: AbortSignal) => Promise<void>): Promise<void>; | ||
| track<T = never>(rebuildFn: (signal: AbortSignal) => Promise<{ | ||
| success: boolean; | ||
| cancelled?: boolean; | ||
| }>, interruptPromise?: Promise<T>): Promise<TrackResult<T>>; | ||
| dispose(): void; | ||
| } | ||
| //# sourceMappingURL=rebuild-queue.d.ts.map |
@@ -5,17 +5,15 @@ import { logger } from './logger.js'; | ||
| buildCounter = 0; | ||
| async enqueue(rebuildFn) { | ||
| async track(rebuildFn, interruptPromise) { | ||
| const buildId = ++this.buildCounter; | ||
| const pendingCancellations = Array.from(this.activeBuilds.values()).map(buildInfo => { | ||
| buildInfo.controller.abort(); | ||
| return buildInfo.buildFinished.promise; | ||
| const pendingCancellations = Array.from(this.activeBuilds.values()).map(buildControl => { | ||
| buildControl.controller.abort(); | ||
| return buildControl.buildFinished.promise; | ||
| }); | ||
| if (pendingCancellations.length > 0) { | ||
| logger.info(`Aborting ${pendingCancellations.length} bundling task(s)..`); | ||
| } | ||
| if (pendingCancellations.length > 0) { | ||
| await Promise.all(pendingCancellations); | ||
| } | ||
| let buildFinished; | ||
| let resolveCompletion; | ||
| const completionPromise = new Promise(resolve => { | ||
| buildFinished = resolve; | ||
| resolveCompletion = resolve; | ||
| }); | ||
@@ -25,3 +23,3 @@ const control = { | ||
| buildFinished: { | ||
| resolve: buildFinished, | ||
| resolve: resolveCompletion, | ||
| promise: completionPromise, | ||
@@ -31,4 +29,25 @@ }, | ||
| this.activeBuilds.set(buildId, control); | ||
| const buildPromise = rebuildFn(control.controller.signal) | ||
| .then(result => ({ type: 'completed', result })) | ||
| .catch(error => ({ type: 'completed', result: { success: false, error } })); | ||
| let trackResult; | ||
| try { | ||
| await rebuildFn(control.controller.signal); | ||
| if (interruptPromise) { | ||
| const interruptResult = interruptPromise.then(value => ({ | ||
| type: 'interrupted', | ||
| value, | ||
| })); | ||
| const raceResult = await Promise.race([buildPromise, interruptResult]); | ||
| if (raceResult.type === 'interrupted') { | ||
| control.controller.abort(); | ||
| await buildPromise; | ||
| trackResult = raceResult; | ||
| } | ||
| else { | ||
| trackResult = raceResult; | ||
| } | ||
| } | ||
| else { | ||
| trackResult = await buildPromise; | ||
| } | ||
| } | ||
@@ -39,6 +58,7 @@ finally { | ||
| } | ||
| return trackResult; | ||
| } | ||
| dispose() { | ||
| for (const [_, buildInfo] of this.activeBuilds) { | ||
| buildInfo.controller.abort(); | ||
| for (const buildControl of this.activeBuilds.values()) { | ||
| buildControl.controller.abort(); | ||
| } | ||
@@ -45,0 +65,0 @@ this.activeBuilds.clear(); |
| export declare function resolveGlobSync(pattern: string, baseDir?: string): string[]; | ||
| //# sourceMappingURL=resolve-glob.d.ts.map |
@@ -18,9 +18,9 @@ import * as fs from 'fs'; | ||
| entries | ||
| .filter((entry) => entry.isDirectory()) | ||
| .forEach((entry) => search(path.join(dir, entry.name), segmentIndex + 1)); | ||
| .filter(entry => entry.isDirectory()) | ||
| .forEach(entry => search(path.join(dir, entry.name), segmentIndex + 1)); | ||
| } | ||
| else { | ||
| entries | ||
| .filter((entry) => entry.name === segment) | ||
| .forEach((entry) => search(path.join(dir, entry.name), segmentIndex + 1)); | ||
| .filter(entry => entry.name === segment) | ||
| .forEach(entry => search(path.join(dir, entry.name), segmentIndex + 1)); | ||
| } | ||
@@ -27,0 +27,0 @@ } |
@@ -1,3 +0,29 @@ | ||
| import type { KeyValuePair } from '../domain/utils/keyvaluepair.contract.js'; | ||
| export declare function resolveWildcardKeys(keyPattern: string, valuePattern: string, cwd: string): KeyValuePair[]; | ||
| //# sourceMappingURL=resolve-wildcard-keys.d.ts.map | ||
| export type KeyValuePair = { | ||
| key: string; | ||
| value: string; | ||
| }; | ||
| /** | ||
| * Resolves tsconfig wildcard paths. | ||
| * | ||
| * In tsconfig.json, paths like `@features/*` → `libs/features/src/*` work as follows: | ||
| * - The `*` captures a single path segment (the module name) | ||
| * - When importing `@features/feature-a`, TypeScript captures `feature-a` | ||
| * - It then replaces `*` in the value pattern: `libs/features/src/feature-a` | ||
| * | ||
| * For discovery, we find all directories at the wildcard position that TypeScript | ||
| * would recognize as valid modules (directories with index files or package.json). | ||
| * | ||
| // @see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution | ||
| */ | ||
| export declare function resolveTsConfigWildcard(keyPattern: string, valuePattern: string, cwd: string): KeyValuePair[]; | ||
| /** | ||
| * Resolves package.json exports wildcard patterns. | ||
| * | ||
| * In package.json exports, patterns like `./features/*.js` → `./src/features/*.js` work as follows: | ||
| * - The `*` is a literal string replacement that can include path separators | ||
| * - Importing `pkg/features/a/b.js` captures `a/b` and replaces `*` → `./src/features/a/b.js` | ||
| * - This matches actual files, not directories | ||
| * | ||
| * @see https://nodejs.org/api/packages.html#subpath-patterns | ||
| */ | ||
| export declare function resolvePackageJsonExportsWildcard(keyPattern: string, valuePattern: string, cwd: string): KeyValuePair[]; |
| import fg from 'fast-glob'; | ||
| function escapeRegex(str) { | ||
| return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| } | ||
| // Convert package.json exports pattern to glob pattern | ||
| // * in exports means "one segment", but for glob we need **/* for deep matching | ||
| // Src: https://hirok.io/posts/package-json-exports#exposing-all-package-files | ||
| function convertExportsToGlob(pattern) { | ||
| return pattern.replace(/(?<!\*)\*(?!\*)/g, '**/*'); | ||
| } | ||
| function compilePattern(pattern) { | ||
| const tokens = pattern.split(/(\*\*|\*)/); | ||
| const regexParts = []; | ||
| for (const token of tokens) { | ||
| if (token === '*') { | ||
| regexParts.push('(.*)'); | ||
| import * as fs from 'fs'; | ||
| import * as path from 'path'; | ||
| import { logger } from './logger.js'; | ||
| // TypeScript's module resolution for directories checks these in order | ||
| // @see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution | ||
| const TS_INDEX_FILES = [ | ||
| 'index.ts', | ||
| 'index.tsx', | ||
| 'index.mts', | ||
| 'index.cts', | ||
| 'index.d.ts', | ||
| 'index.js', | ||
| 'index.jsx', | ||
| 'index.mjs', | ||
| 'index.cjs', | ||
| ]; | ||
| /** | ||
| * Resolves tsconfig wildcard paths. | ||
| * | ||
| * In tsconfig.json, paths like `@features/*` → `libs/features/src/*` work as follows: | ||
| * - The `*` captures a single path segment (the module name) | ||
| * - When importing `@features/feature-a`, TypeScript captures `feature-a` | ||
| * - It then replaces `*` in the value pattern: `libs/features/src/feature-a` | ||
| * | ||
| * For discovery, we find all directories at the wildcard position that TypeScript | ||
| * would recognize as valid modules (directories with index files or package.json). | ||
| * | ||
| // @see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution | ||
| */ | ||
| export function resolveTsConfigWildcard(keyPattern, valuePattern, cwd) { | ||
| const normalizedPattern = valuePattern.replace(/^\.?\/+/, ''); | ||
| const asteriskIndex = normalizedPattern.indexOf('*'); | ||
| if (asteriskIndex === -1) { | ||
| return []; | ||
| } | ||
| const prefix = normalizedPattern.substring(0, asteriskIndex); | ||
| const suffix = normalizedPattern.substring(asteriskIndex + 1); | ||
| const searchPath = path.join(cwd, prefix); | ||
| let entries; | ||
| try { | ||
| entries = fs.readdirSync(searchPath); | ||
| } | ||
| catch { | ||
| return []; | ||
| } | ||
| const keys = []; | ||
| for (const entry of entries) { | ||
| const entryPath = path.join(searchPath, entry); | ||
| let stats; | ||
| try { | ||
| stats = fs.statSync(entryPath); | ||
| } | ||
| else { | ||
| regexParts.push(escapeRegex(token)); | ||
| catch { | ||
| continue; | ||
| } | ||
| } | ||
| return new RegExp(`^${regexParts.join('')}$`); | ||
| } | ||
| function withoutWildcard(template, wildcardValues) { | ||
| const tokens = template.split(/(\*\*|\*)/); | ||
| let result = ''; | ||
| let i = 0; | ||
| for (const token of tokens) { | ||
| if (token === '*') { | ||
| result += wildcardValues[i++]; | ||
| if (!stats.isDirectory()) { | ||
| // Skipping individual files, we only process modules | ||
| continue; | ||
| } | ||
| else { | ||
| result += token; | ||
| let modulePath = path.join(prefix, entry, suffix).replace(/\\/g, '/'); | ||
| const fullPath = path.join(cwd, modulePath); | ||
| let fullPathStats; | ||
| try { | ||
| fullPathStats = fs.statSync(fullPath); | ||
| } | ||
| catch { | ||
| continue; | ||
| } | ||
| const key = keyPattern.replace('*', entry); | ||
| if (fullPathStats.isDirectory()) { | ||
| const indexFile = TS_INDEX_FILES.find(indexFile => fs.existsSync(path.join(fullPath, indexFile))); | ||
| if (!indexFile) { | ||
| logger.warn(`[shared-mappings] Internal lib '${key}' does not contain an entryPoint (barrel file).`); | ||
| continue; | ||
| } | ||
| modulePath = path.join(modulePath, indexFile); | ||
| } | ||
| else if (!fullPathStats.isFile()) { | ||
| continue; | ||
| } | ||
| keys.push({ | ||
| key, | ||
| value: modulePath, | ||
| }); | ||
| } | ||
| return result; | ||
| return keys; | ||
| } | ||
| export function resolveWildcardKeys(keyPattern, valuePattern, cwd) { | ||
| /** | ||
| * Resolves package.json exports wildcard patterns. | ||
| * | ||
| * In package.json exports, patterns like `./features/*.js` → `./src/features/*.js` work as follows: | ||
| * - The `*` is a literal string replacement that can include path separators | ||
| * - Importing `pkg/features/a/b.js` captures `a/b` and replaces `*` → `./src/features/a/b.js` | ||
| * - This matches actual files, not directories | ||
| * | ||
| * @see https://nodejs.org/api/packages.html#subpath-patterns | ||
| */ | ||
| export function resolvePackageJsonExportsWildcard(keyPattern, valuePattern, cwd) { | ||
| const normalizedPattern = valuePattern.replace(/^\.?\/+/, ''); | ||
| const globPattern = convertExportsToGlob(normalizedPattern); | ||
| const regex = compilePattern(normalizedPattern); | ||
| const files = fg.sync(globPattern, { | ||
| const asteriskIndex = normalizedPattern.indexOf('*'); | ||
| if (asteriskIndex === -1) { | ||
| return []; | ||
| } | ||
| const prefix = normalizedPattern.substring(0, asteriskIndex); | ||
| const suffix = normalizedPattern.substring(asteriskIndex + 1); | ||
| // fast-glob requires **/* pattern for matching files at any depth | ||
| const files = fg.sync(prefix + '**/*' + suffix, { | ||
| cwd, | ||
@@ -50,7 +116,8 @@ onlyFiles: true, | ||
| const relPath = file.replace(/\\/g, '/').replace(/^\.\//, ''); | ||
| const wildcards = relPath.match(regex); | ||
| if (!wildcards) | ||
| continue; | ||
| const captured = suffix | ||
| ? relPath.slice(prefix.length, -suffix.length) | ||
| : relPath.slice(prefix.length); | ||
| const key = keyPattern.replace('*', captured); | ||
| keys.push({ | ||
| key: withoutWildcard(keyPattern, wildcards.slice(1)), | ||
| key, | ||
| value: relPath, | ||
@@ -57,0 +124,0 @@ }); |
@@ -1,5 +0,2 @@ | ||
| export declare const INTERNAL_SCOPE = "@nf-internal"; | ||
| export declare function rewriteChunkImports(filePath: string): void; | ||
| export declare function isSourceFile(fileName: string): boolean; | ||
| export declare function deriveInternalName(fileName: string): string; | ||
| //# sourceMappingURL=rewrite-chunk-imports.d.ts.map |
| import * as ts from 'typescript'; | ||
| import * as fs from 'fs'; | ||
| import * as path from 'path'; | ||
| export const INTERNAL_SCOPE = '@nf-internal'; | ||
| import { toChunkImport } from '../domain/core/chunk.js'; | ||
| export function rewriteChunkImports(filePath) { | ||
@@ -16,3 +16,3 @@ const sourceCode = fs.readFileSync(filePath, 'utf-8'); | ||
| if (text.startsWith('./')) { | ||
| const newModuleSpecifier = ts.factory.createStringLiteral(deriveInternalName(text)); | ||
| const newModuleSpecifier = ts.factory.createStringLiteral(toChunkImport(text)); | ||
| if (ts.isImportDeclaration(node)) { | ||
@@ -33,3 +33,3 @@ return ts.factory.updateImportDeclaration(node, node.modifiers, node.importClause, newModuleSpecifier, node.assertClause); | ||
| if (text.startsWith('./')) { | ||
| const newArg = ts.factory.createStringLiteral(deriveInternalName(text)); | ||
| const newArg = ts.factory.createStringLiteral(toChunkImport(text)); | ||
| return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ | ||
@@ -51,8 +51,1 @@ newArg, | ||
| } | ||
| export function deriveInternalName(fileName) { | ||
| if (fileName.startsWith('./')) { | ||
| fileName = fileName.slice(2); | ||
| } | ||
| const packageName = fileName.replace(/.(m|c)?js$/, ''); | ||
| return INTERNAL_SCOPE + '/' + packageName; | ||
| } |
| {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC"} |
| {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/domain.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC"} |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE7F,cAAc,aAAa,CAAC"} |
| {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,YAAY,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,YAAY,EACV,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,iDAAiD,CAAC;AACzD,YAAY,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC"} |
| {"version":3,"file":"configuration-context.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/configuration-context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,wBAAgB,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,gBAAgB,IAAI,oBAAoB,CAEvD"} |
| {"version":3,"file":"default-skip-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/default-skip-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAU,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAEjG,eAAO,MAAM,iBAAiB,EAAE,QAuB/B,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAMpE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAc/E"} |
| {"version":3,"file":"share-utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/share-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,wCAAwC,CAAC;AAM9F,OAAO,KAAK,EAGV,wBAAwB,EAExB,qBAAqB,EACtB,MAAM,8CAA8C,CAAC;AAKtD,eAAO,MAAM,6BAA6B,UAAyD,CAAC;AAEpG,wBAAgB,oBAAoB,IAAI,MAAM,CAa7C;AAwSD,wBAAgB,QAAQ,CACtB,MAAM,EAAE,wBAAwB,EAChC,IAAI,GAAE;IACJ,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,qBAAqB,CAAC;CAC9B,GACL,qBAAqB,GAAG,IAAI,CAsC9B;AAiBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEpD;AAED,wBAAgB,KAAK,CACnB,sBAAsB,EAAE,qBAAqB,EAC7C,WAAW,SAAK,EAChB,QAAQ,WAAoB,GAC3B,qBAAqB,CA6DvB"} |
| {"version":3,"file":"with-native-federation.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/with-native-federation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,gDAAgD,CAAC;AASxD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,GAAG,0BAA0B,CAsBzF"} |
| {"version":3,"file":"build-adapter.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/build-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAS/E,wBAAgB,eAAe,CAAC,YAAY,EAAE,cAAc,GAAG,IAAI,CAElE;AAED,wBAAgB,eAAe,IAAI,cAAc,CAEhD"} |
| {"version":3,"file":"build-for-federation.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/build-for-federation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,4CAA4C,CAAC;AAOpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAOvF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAEjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,eAAO,MAAM,kBAAkB,EAAE,WAGhC,CAAC;AAIF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,MAAM,EAAE,EACnB,WAAW,cAAqB,GAC/B,OAAO,CAAC,cAAc,CAAC,CAgIzB"} |
| {"version":3,"file":"bundle-exposed-and-mappings.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/bundle-exposed-and-mappings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACX,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAKjG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIvF,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,MAAM,EAAE,EACnB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,CAkFvB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,iBAAiB,GACzB,KAAK,CAAC,WAAW,CAAC,CAoBpB;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,iBAAiB,GAC5B,KAAK,CAAC,UAAU,CAAC,CAoBnB"} |
| {"version":3,"file":"bundle-shared.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/bundle-shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAGjG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAWvF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAG7F,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,EACvD,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,EAAE,SAAS,GAAG,MAAM,YAAY,EACxC,YAAY,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxD,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAkI5B"} |
| {"version":3,"file":"default-external-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/default-external-list.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,qBAAqB,UAGhC,CAAC"} |
| export declare const DEFAULT_SERVER_DEPS_LIST: string[]; | ||
| export declare const DEFAULT_SERVER_DEPS_SET: Set<string>; | ||
| //# sourceMappingURL=default-server-deps-list.d.ts.map |
| {"version":3,"file":"default-server-deps-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/default-server-deps-list.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAI5C,CAAC;AAEF,eAAO,MAAM,uBAAuB,aAAoC,CAAC"} |
| export const DEFAULT_SERVER_DEPS_LIST = [ | ||
| '@angular/platform-server', | ||
| '@angular/platform-server/init', | ||
| '@angular/ssr', | ||
| ]; | ||
| export const DEFAULT_SERVER_DEPS_SET = new Set(DEFAULT_SERVER_DEPS_LIST); |
| {"version":3,"file":"federation-builder.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/federation-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAEjF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAGjG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,cAAc,CAAC;CACzB;AAOD,iBAAe,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ5D;AAED,iBAAe,KAAK,CAAC,WAAW,wCAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpE;AAED,eAAO,MAAM,iBAAiB;;;;wBAMX,MAAM,EAAE;qBAGX,0BAA0B;CAGzC,CAAC"} |
| {"version":3,"file":"get-externals.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/get-externals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAEjG,wBAAgB,YAAY,CAAC,MAAM,EAAE,0BAA0B,YAK9D"} |
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| import type { FederationOptions } from '../domain/core/federation-options.contract.js'; | ||
| export declare function loadFederationConfig(fedOptions: FederationOptions): Promise<NormalizedFederationConfig>; | ||
| //# sourceMappingURL=load-federation-config.d.ts.map |
| {"version":3,"file":"load-federation-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/load-federation-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AACjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAKvF,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,0BAA0B,CAAC,CAsBrC"} |
| import * as path from 'path'; | ||
| import * as fs from 'fs'; | ||
| import { removeUnusedDeps } from './remove-unused-deps.js'; | ||
| export async function loadFederationConfig(fedOptions) { | ||
| const fullConfigPath = path.join(fedOptions.workspaceRoot, fedOptions.federationConfig); | ||
| if (!fs.existsSync(fullConfigPath)) { | ||
| throw new Error('Expected ' + fullConfigPath); | ||
| } | ||
| const config = (await import(fullConfigPath))?.default; | ||
| if (config.features.ignoreUnusedDeps && !fedOptions.entryPoint) { | ||
| throw new Error(`The feature ignoreUnusedDeps needs the application's entry point. Please set it in your federation options!`); | ||
| } | ||
| if (config.features.ignoreUnusedDeps) { | ||
| // const entryPoint = path.join(fedOptions.workspaceRoot, fedOptions.entryPoint ?? ''); | ||
| return removeUnusedDeps(config, fedOptions.entryPoint ?? '', fedOptions.workspaceRoot); | ||
| } | ||
| return config; | ||
| } |
| import type { NormalizedFederationConfig } from '../domain/config/federation-config.contract.js'; | ||
| export declare function removeUnusedDeps(config: NormalizedFederationConfig, main: string, workspaceRoot: string): NormalizedFederationConfig; | ||
| //# sourceMappingURL=remove-unused-deps.d.ts.map |
| {"version":3,"file":"remove-unused-deps.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/remove-unused-deps.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAMjG,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB,0BAA0B,CAiB5B"} |
| import { getProjectData } from '@softarc/sheriff-core'; | ||
| import path from 'path'; | ||
| import fs from 'fs'; | ||
| import { cwd } from 'process'; | ||
| import { getPackageInfo } from '../utils/package-info.js'; | ||
| import { getExternalImports as extractExternalImports } from '../utils/get-external-imports.js'; | ||
| import { normalizePackageName } from '../utils/normalize.js'; | ||
| export function removeUnusedDeps(config, main, workspaceRoot) { | ||
| const fileInfos = getProjectData(main, cwd(), { | ||
| includeExternalLibraries: true, | ||
| }); | ||
| const usedDeps = findUsedDeps(fileInfos, workspaceRoot, config); | ||
| const usedPackageNames = usedDeps.usedPackageNames; | ||
| const usedMappings = usedDeps.usedMappings; | ||
| const usedPackageNamesWithTransient = addTransientDeps(usedPackageNames, workspaceRoot); | ||
| const filteredShared = filterShared(config, usedPackageNamesWithTransient); | ||
| return { | ||
| ...config, | ||
| shared: filteredShared, | ||
| sharedMappings: [...usedMappings], | ||
| }; | ||
| } | ||
| function filterShared(config, usedPackageNamesWithTransient) { | ||
| return Object.entries(config.shared) | ||
| .filter(([shared, meta]) => !!meta.includeSecondaries || usedPackageNamesWithTransient.has(shared)) | ||
| .reduce((acc, [shared, meta]) => ({ ...acc, [shared]: meta }), {}); | ||
| } | ||
| function findUsedDeps(fileInfos, workspaceRoot, config) { | ||
| const usedPackageNames = new Set(); | ||
| const usedMappings = new Set(); | ||
| for (const fileName of Object.keys(fileInfos)) { | ||
| const fileInfo = fileInfos[fileName]; | ||
| if (!fileInfo) { | ||
| continue; | ||
| } | ||
| const libs = [...(fileInfo.externalLibraries || []), ...(fileInfo.unresolvedImports || [])]; | ||
| for (const pckg of libs) { | ||
| usedPackageNames.add(pckg); | ||
| } | ||
| const fullFileName = path.join(workspaceRoot, fileName); | ||
| const mappings = config.sharedMappings.filter(sm => fullFileName.startsWith(sm.path)); | ||
| for (const mapping of mappings) { | ||
| usedMappings.add(mapping); | ||
| } | ||
| } | ||
| return { usedPackageNames, usedMappings }; | ||
| } | ||
| function addTransientDeps(packages, workspaceRoot) { | ||
| const packagesAndPeers = new Set([...packages]); | ||
| const discovered = new Set(packagesAndPeers); | ||
| const stack = [...packagesAndPeers]; | ||
| while (stack.length > 0) { | ||
| const dep = stack.pop(); | ||
| if (!dep) { | ||
| continue; | ||
| } | ||
| const pInfo = getPackageInfo(dep, workspaceRoot); | ||
| if (!pInfo) { | ||
| continue; | ||
| } | ||
| const peerDeps = getExternalImports(pInfo, workspaceRoot); | ||
| for (const peerDep of peerDeps) { | ||
| if (!discovered.has(peerDep)) { | ||
| discovered.add(peerDep); | ||
| stack.push(peerDep); | ||
| packagesAndPeers.add(peerDep); | ||
| } | ||
| } | ||
| } | ||
| return packagesAndPeers; | ||
| } | ||
| function getExternalImports(pInfo, workspaceRoot) { | ||
| const encodedPackageName = normalizePackageName(pInfo.packageName); | ||
| const cacheFileName = `${encodedPackageName}-${pInfo.version}.deps.json`; | ||
| const cachePath = path.join(workspaceRoot, 'node_modules/.cache/native-federation/_externals-metadata'); | ||
| const cacheFilePath = path.join(cachePath, cacheFileName); | ||
| const cacheHit = fs.existsSync(cacheFilePath); | ||
| let peerDeps; | ||
| if (cacheHit) { | ||
| peerDeps = JSON.parse(fs.readFileSync(cacheFilePath, 'utf-8')); | ||
| } | ||
| else { | ||
| peerDeps = extractExternalImports(pInfo.entryPoint); | ||
| fs.mkdirSync(cachePath, { recursive: true }); | ||
| fs.writeFileSync(cacheFilePath, JSON.stringify(peerDeps, undefined, 2), 'utf-8'); | ||
| } | ||
| return peerDeps; | ||
| } |
| {"version":3,"file":"write-federation-info.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/write-federation-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAGjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,QAOhG"} |
| {"version":3,"file":"write-import-map.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/write-import-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,iBAAiB,QAWpF"} |
| {"version":3,"file":"external-config.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/config/external-config.contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,WAAW,CAAC,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,WAAW,CAAC,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,OAAO,CAAC;KACd,CAAC;CACH;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACrE,OAAO,CAAC;AAEZ,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEnE,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAEvF,MAAM,MAAM,wBAAwB,GAAG,cAAc,GAAG;IACtD,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC"} |
| {"version":3,"file":"federation-config.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/config/federation-config.contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EACV,+BAA+B,EAC/B,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;CACH;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,+BAA+B,CAAC;IACxC,cAAc,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE;QACR,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,OAAO,CAAC;KAC3B,CAAC;CACH"} |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/config/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"} |
| {"version":3,"file":"skip-list.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/config/skip-list.contract.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACrD,MAAM,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC"} |
| {"version":3,"file":"build-adapter.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/core/build-adapter.contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;AAEjG,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,SAAS,GAAG,oBAAoB,CAAC;AAE/F,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB"} |
| {"version":3,"file":"build-notification-options.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/core/build-notification-options.contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,qBAAqB;IAC/B,SAAS,gCAAgC;IACzC,KAAK,6BAA6B;IAClC,SAAS,iCAAiC;CAC3C"} |
| export interface BuildParams { | ||
| skipMappingsAndExposed: boolean; | ||
| skipShared: boolean; | ||
| signal?: AbortSignal; | ||
| } | ||
| //# sourceMappingURL=build-params.contract.d.ts.map |
| {"version":3,"file":"build-params.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/core/build-params.contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,sBAAsB,EAAE,OAAO,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"} |
| export {}; |
| {"version":3,"file":"federation-info.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/core/federation-info.contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AACF,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB"} |
| {"version":3,"file":"federation-options.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/core/federation-options.contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEzF,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;CAC/C"} |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,wBAAwB,EAC7B,qBAAqB,GACtB,MAAM,0CAA0C,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,YAAY,EACV,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC"} |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/utils/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC"} |
| {"version":3,"file":"keyvaluepair.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/utils/keyvaluepair.contract.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"} |
| {"version":3,"file":"mapped-path.contract.d.ts","sourceRoot":"","sources":["../../../../../src/lib/domain/utils/mapped-path.contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd"} |
| {"version":3,"file":"build-result-map.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/build-result-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAErF,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,oBAAoB,EAAE,EACnC,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBxB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAG1F"} |
| import type { NFBuildAdapterOptions } from '../domain/core/build-adapter.contract.js'; | ||
| export declare function bundle(options: NFBuildAdapterOptions): Promise<import("../domain/core/build-adapter.contract.js").NFBuildAdapterResult[]>; | ||
| //# sourceMappingURL=build-utils.d.ts.map |
| {"version":3,"file":"build-utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/build-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAGtF,wBAAsB,MAAM,CAAC,OAAO,EAAE,qBAAqB,sFAG1D"} |
| import { getBuildAdapter } from '../core/build-adapter.js'; | ||
| export async function bundle(options) { | ||
| const adapter = getBuildAdapter(); | ||
| return await adapter(options); | ||
| } |
| import type { NormalizedExternalConfig } from '../domain/config/external-config.contract.js'; | ||
| import type { SharedInfo } from '../domain/core/federation-info.contract.js'; | ||
| export declare const getCachePath: (workspaceRoot: string, project: string) => string; | ||
| export declare const getFilename: (title: string, dev?: boolean) => string; | ||
| export declare const getChecksum: (shared: Record<string, NormalizedExternalConfig>, dev: "1" | "0") => string; | ||
| export declare const cacheEntry: (pathToCache: string, fileName: string) => { | ||
| getMetadata: (checksum: string) => { | ||
| checksum: string; | ||
| externals: SharedInfo[]; | ||
| files: string[]; | ||
| } | undefined; | ||
| persist: (payload: { | ||
| checksum: string; | ||
| externals: SharedInfo[]; | ||
| files: string[]; | ||
| }) => void; | ||
| copyFiles: (fullOutputPath: string) => void; | ||
| clear: () => void; | ||
| }; | ||
| //# sourceMappingURL=bundle-caching.d.ts.map |
| {"version":3,"file":"bundle-caching.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/bundle-caching.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAG7E,eAAO,MAAM,YAAY,GAAI,eAAe,MAAM,EAAE,SAAS,MAAM,WACS,CAAC;AAE7E,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,MAAM,OAAO,WAGvD,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,EAChD,KAAK,GAAG,GAAG,GAAG,KACb,MAaF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,aAAa,MAAM,EAAE,UAAU,MAAM;4BAElD,MAAM,KAEd;QACE,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,UAAU,EAAE,CAAC;QACxB,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GACD,SAAS;uBAYM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE;gCAGrD,MAAM;;CA6ClC,CAAC"} |
| import path from 'path'; | ||
| import fs from 'fs'; | ||
| import crypto from 'crypto'; | ||
| import { logger } from '../utils/logger.js'; | ||
| export const getCachePath = (workspaceRoot, project) => path.join(workspaceRoot, 'node_modules/.cache/native-federation', project); | ||
| export const getFilename = (title, dev) => { | ||
| const devSuffix = dev ? '-dev' : ''; | ||
| return `${title}${devSuffix}.meta.json`; | ||
| }; | ||
| export const getChecksum = (shared, dev) => { | ||
| const denseExternals = Object.keys(shared) | ||
| .sort() | ||
| .reduce((clean, external) => { | ||
| return (clean + ':' + external + (shared[external].version ? `@${shared[external].version}` : '')); | ||
| }, 'deps'); | ||
| return crypto | ||
| .createHash('sha256') | ||
| .update(denseExternals + `:dev=${dev}`) | ||
| .digest('hex'); | ||
| }; | ||
| export const cacheEntry = (pathToCache, fileName) => ({ | ||
| getMetadata: (checksum) => { | ||
| const metadataFile = path.join(pathToCache, fileName); | ||
| if (!fs.existsSync(pathToCache) || !fs.existsSync(metadataFile)) | ||
| return undefined; | ||
| const cachedResult = JSON.parse(fs.readFileSync(metadataFile, 'utf-8')); | ||
| if (cachedResult.checksum !== checksum) | ||
| return undefined; | ||
| return cachedResult; | ||
| }, | ||
| persist: (payload) => { | ||
| fs.writeFileSync(path.join(pathToCache, fileName), JSON.stringify(payload), 'utf-8'); | ||
| }, | ||
| copyFiles: (fullOutputPath) => { | ||
| const metadataFile = path.join(pathToCache, fileName); | ||
| if (!fs.existsSync(metadataFile)) | ||
| throw new Error('Error copying artifacts to dist, metadata file could not be found.'); | ||
| const cachedResult = JSON.parse(fs.readFileSync(metadataFile, 'utf-8')); | ||
| fs.mkdirSync(path.dirname(fullOutputPath), { recursive: true }); | ||
| cachedResult.files.forEach(file => { | ||
| const cachedFile = path.join(pathToCache, file); | ||
| const distFileName = path.join(fullOutputPath, file); | ||
| if (fs.existsSync(cachedFile)) { | ||
| fs.copyFileSync(cachedFile, distFileName); | ||
| } | ||
| }); | ||
| }, | ||
| clear: () => { | ||
| const metadataFile = path.join(pathToCache, fileName); | ||
| if (!fs.existsSync(pathToCache)) { | ||
| fs.mkdirSync(pathToCache, { recursive: true }); | ||
| logger.debug(`Creating cache folder '${pathToCache}' for '${fileName}'.`); | ||
| return; | ||
| } | ||
| if (!fs.existsSync(metadataFile)) | ||
| return; | ||
| logger.debug(`Purging cached bundle '${metadataFile}'.`); | ||
| const cachedResult = JSON.parse(fs.readFileSync(metadataFile, 'utf-8')); | ||
| cachedResult.files.forEach(file => { | ||
| const cachedFile = path.join(pathToCache, file); | ||
| if (fs.existsSync(cachedFile)) | ||
| fs.unlinkSync(cachedFile); | ||
| }); | ||
| fs.unlinkSync(metadataFile); | ||
| }, | ||
| }); |
| {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAK5B"} |
| {"version":3,"file":"get-external-imports.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/get-external-imports.ts"],"names":[],"mappings":"AAIA,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,YA2FvD"} |
| {"version":3,"file":"hash-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/hash-file.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjD"} |
| {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/logger.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM;gBACL,GAAG;iBACF,GAAG;kBACF,GAAG;gBACL,GAAG;mBACA,GAAG;iBAEL,GAAG;qBAEC,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,MAAM;CAkBrD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,SAExC,CAAC"} |
| {"version":3,"file":"mapped-paths.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/mapped-paths.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAE1E,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,EAC7B,gBAAgB,EAChB,cAAc,EACd,QAAQ,GACT,EAAE,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAAC,CAoC3C"} |
| {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/normalize.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAgBvE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,UAGpD"} |
| {"version":3,"file":"package-info.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/package-info.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,GAAG,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,SAAS,GACT,MAAM,GACN,KAAK,GACL,KAAK,GACL,SAAS,GACT,OAAO,GACP,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,OAAO,GAAG,SAWjD,CAAC;AACF,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,SAAS,GACT;KAAG,GAAG,IAAI,eAAe,CAAC,CAAC,EAAE,WAAW;CAAE,GAC1C,WAAW,EAAE,CAAC;AAElB,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG;IAAE,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,GAAG,WAAW,CAAA;CAAE,CAAC;AAI9F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAIjF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBrE;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAc7F;AAMD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,CAI/E;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE,CAqBzF;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA6B1F;AAiDD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAoI1F"} |
| {"version":3,"file":"rebuild-queue.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/rebuild-queue.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAwC;IAC5D,OAAO,CAAC,YAAY,CAAK;IAEnB,OAAO,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC/E,OAAO,IAAI,IAAI;CAMhB"} |
| {"version":3,"file":"resolve-glob.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/resolve-glob.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,SAAgB,GACtB,MAAM,EAAE,CAkCV"} |
| {"version":3,"file":"resolve-wildcard-keys.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/resolve-wildcard-keys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AA0C7E,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,GACV,YAAY,EAAE,CA4BhB"} |
| {"version":3,"file":"rewrite-chunk-imports.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/rewrite-chunk-imports.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,QAmEnD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO3D"} |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2634
17.64%109262
-4.52%103
-27.46%22
37.5%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated