@softarc/native-federation
Advanced tools
Comparing version 2.0.12 to 2.0.13
{ | ||
"name": "@softarc/native-federation", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"type": "commonjs", | ||
@@ -9,3 +9,3 @@ "license": "MIT", | ||
"npmlog": "^6.0.2", | ||
"@softarc/native-federation-runtime": "2.0.12" | ||
"@softarc/native-federation-runtime": "2.0.13" | ||
}, | ||
@@ -12,0 +12,0 @@ "main": "./src/index.js", |
@@ -0,1 +1,2 @@ | ||
export { DEFAULT_SKIP_LIST } from './lib/core/default-skip-list'; | ||
export { NormalizedFederationConfig } from './lib/config/federation-config'; | ||
@@ -2,0 +3,0 @@ export { FederationOptions } from './lib/core/federation-options'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hashFile = exports.setLogLevel = exports.logger = exports.federationBuilder = exports.findRootTsConfigJson = exports.shareAll = exports.share = exports.bundleExposedAndMappings = exports.buildForFederation = exports.withNativeFederation = exports.loadFederationConfig = exports.getExternals = exports.writeFederationInfo = exports.writeImportMap = exports.setBuildAdapter = void 0; | ||
exports.hashFile = exports.setLogLevel = exports.logger = exports.federationBuilder = exports.findRootTsConfigJson = exports.shareAll = exports.share = exports.bundleExposedAndMappings = exports.buildForFederation = exports.withNativeFederation = exports.loadFederationConfig = exports.getExternals = exports.writeFederationInfo = exports.writeImportMap = exports.setBuildAdapter = exports.DEFAULT_SKIP_LIST = void 0; | ||
const tslib_1 = require("tslib"); | ||
var default_skip_list_1 = require("./lib/core/default-skip-list"); | ||
Object.defineProperty(exports, "DEFAULT_SKIP_LIST", { enumerable: true, get: function () { return default_skip_list_1.DEFAULT_SKIP_LIST; } }); | ||
var build_adapter_1 = require("./lib/core/build-adapter"); | ||
@@ -6,0 +8,0 @@ Object.defineProperty(exports, "setBuildAdapter", { enumerable: true, get: function () { return build_adapter_1.setBuildAdapter; } }); |
@@ -9,2 +9,7 @@ import { SkipList } from '../core/default-skip-list'; | ||
includeSecondaries?: boolean; | ||
packageInfo?: { | ||
entryPoint: string; | ||
version: string; | ||
esm: boolean; | ||
}; | ||
} | ||
@@ -24,2 +29,7 @@ export interface FederationConfig { | ||
includeSecondaries?: boolean; | ||
packageInfo?: { | ||
entryPoint: string; | ||
version: string; | ||
esm: boolean; | ||
}; | ||
} | ||
@@ -26,0 +36,0 @@ export interface NormalizedFederationConfig { |
@@ -15,3 +15,3 @@ import { SharedConfig } from './federation-config'; | ||
export declare function setInferVersion(infer: boolean): void; | ||
export declare function share(configuredShareObjects: Config, projectPath?: string): Config; | ||
export declare function share(configuredShareObjects: Config, projectPath?: string, skipList?: SkipList): Config; | ||
export {}; |
@@ -147,3 +147,5 @@ "use strict"; | ||
} | ||
if (!(entry === null || entry === void 0 ? void 0 : entry.endsWith('.js')) && !(entry === null || entry === void 0 ? void 0 : entry.endsWith('.mjs')) && !(entry === null || entry === void 0 ? void 0 : entry.endsWith('.cjs'))) { | ||
if (!(entry === null || entry === void 0 ? void 0 : entry.endsWith('.js')) && | ||
!(entry === null || entry === void 0 ? void 0 : entry.endsWith('.mjs')) && | ||
!(entry === null || entry === void 0 ? void 0 : entry.endsWith('.cjs'))) { | ||
continue; | ||
@@ -161,3 +163,3 @@ } | ||
if (key.includes('*')) { | ||
items = (0, resolve_glob_1.resolveGlobSync)(key, libPath).map(e => path.join(parent, e.substring(libPath.length))); | ||
items = (0, resolve_glob_1.resolveGlobSync)(key, libPath).map((e) => path.join(parent, e.substring(libPath.length))); | ||
} | ||
@@ -207,3 +209,3 @@ else { | ||
} | ||
return module.exports.share(share, projectPath); | ||
return module.exports.share(share, projectPath, skip); | ||
} | ||
@@ -225,3 +227,3 @@ function inferProjectPath(projectPath) { | ||
} | ||
function findTransientDeps(packageNames, projectRoot) { | ||
function findTransientDeps(packageNames, projectRoot, preparedSkipList) { | ||
const discovered = new Set(); | ||
@@ -231,7 +233,7 @@ const result = []; | ||
const packagePath = path.join(projectRoot, 'node_modules', packageName, 'package.json'); | ||
_findTransientDeps(packagePath, projectRoot, discovered, result); | ||
_findTransientDeps(packagePath, projectRoot, preparedSkipList, discovered, result); | ||
} | ||
return result; | ||
} | ||
function _findTransientDeps(packagePath, projectRoot, discovered, result) { | ||
function _findTransientDeps(packagePath, projectRoot, preparedSkipList, discovered, result) { | ||
var _a; | ||
@@ -246,3 +248,5 @@ if (!fs.existsSync(packagePath)) { | ||
const depPath = path.dirname(depPackageJson); | ||
if (!discovered.has(depPackageJson)) { | ||
if (!discovered.has(depPackageJson) && | ||
!(0, default_skip_list_1.isInSkipList)(dep, preparedSkipList) && | ||
fs.existsSync(depPackageJson)) { | ||
discovered.add(depPackageJson); | ||
@@ -255,7 +259,7 @@ const version = packageJson.dependencies[dep]; | ||
}); | ||
_findTransientDeps(depPackageJson, projectRoot, discovered, result); | ||
_findTransientDeps(depPackageJson, projectRoot, preparedSkipList, discovered, result); | ||
} | ||
} | ||
} | ||
function share(configuredShareObjects, projectPath = '') { | ||
function share(configuredShareObjects, projectPath = '', skipList = default_skip_list_1.DEFAULT_SKIP_LIST) { | ||
projectPath = inferProjectPath(projectPath); | ||
@@ -265,3 +269,4 @@ const packagePath = findPackageJson(projectPath); | ||
const packageDirectory = path.dirname(packagePath); | ||
const transientDeps = findTransientDeps(sharedPackageNames, packageDirectory); | ||
const preparedSkipList = (0, default_skip_list_1.prepareSkipList)(skipList); | ||
const transientDeps = findTransientDeps(sharedPackageNames, packageDirectory, preparedSkipList); | ||
const transientShareObject = transientDeps.reduce((acc, curr) => (Object.assign(Object.assign({}, acc), { [curr.packageName]: { path: curr.packagePath } })), {}); | ||
@@ -268,0 +273,0 @@ const shareObjects = Object.assign(Object.assign({}, configuredShareObjects), transientShareObject); |
@@ -37,2 +37,3 @@ "use strict"; | ||
includeSecondaries: shared[cur].includeSecondaries, | ||
packageInfo: shared[cur].packageInfo, | ||
} })); | ||
@@ -39,0 +40,0 @@ }, {}); |
@@ -20,6 +20,10 @@ "use strict"; | ||
fs.mkdirSync(cachePath, { recursive: true }); | ||
const packageInfos = Object.keys(config.shared) | ||
// .filter((packageName) => !isInSkipList(packageName, PREPARED_DEFAULT_SKIP_LIST)) | ||
const inferedPackageInfos = Object.keys(config.shared) | ||
.filter((packageName) => !config.shared[packageName].packageInfo) | ||
.map((packageName) => (0, package_info_1.getPackageInfo)(packageName, folder)) | ||
.filter((pi) => !!pi); | ||
const configuredPackageInfos = Object.keys(config.shared) | ||
.filter((packageName) => !!config.shared[packageName].packageInfo) | ||
.map((packageName) => (Object.assign({ packageName }, config.shared[packageName].packageInfo))); | ||
const packageInfos = [...inferedPackageInfos, ...configuredPackageInfos]; | ||
const configState = fs.readFileSync(path.join(__dirname, '../../../package.json')) + | ||
@@ -26,0 +30,0 @@ JSON.stringify(config); |
@@ -22,5 +22,5 @@ "use strict"; | ||
(pkg) => pkg.startsWith('rxjs/internal'), | ||
'@angular/platform-server', | ||
'@angular/platform-server/init', | ||
'@angular/ssr', | ||
// '@angular/platform-server', | ||
// '@angular/platform-server/init', | ||
// '@angular/ssr', | ||
'express', | ||
@@ -27,0 +27,0 @@ /\/schematics(\/|$)/, |
@@ -22,9 +22,9 @@ "use strict"; | ||
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)); | ||
} | ||
@@ -31,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
128108
1554
+ Added@softarc/native-federation-runtime@2.0.13(transitive)
- Removed@softarc/native-federation-runtime@2.0.12(transitive)