@softarc/native-federation
Advanced tools
Comparing version 1.1.0 to 1.1.1-beta.0
{ | ||
"name": "@softarc/native-federation", | ||
"version": "1.1.0", | ||
"version": "1.1.1-beta.0", | ||
"type": "commonjs", | ||
@@ -8,3 +8,3 @@ "dependencies": { | ||
"npmlog": "^6.0.2", | ||
"@softarc/native-federation-runtime": "1.1.0" | ||
"@softarc/native-federation-runtime": "1.1.1-beta.0" | ||
}, | ||
@@ -11,0 +11,0 @@ "main": "./src/index.js", |
@@ -313,3 +313,4 @@ # @softarc/native-federation | ||
{ | ||
"shimMode": true | ||
"shimMode": true, | ||
"mapOverrides": true | ||
} | ||
@@ -316,0 +317,0 @@ </script> |
export interface ConfigurationContext { | ||
workspaceRoot?: string; | ||
packageJson?: string; | ||
} | ||
export declare function useWorkspace(workspaceRoot: string): void; | ||
export declare function usePackageJson(packageJson?: string): void; | ||
export declare function getConfigContext(): ConfigurationContext; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getConfigContext = exports.useWorkspace = void 0; | ||
exports.getConfigContext = exports.usePackageJson = exports.useWorkspace = void 0; | ||
let _context = {}; | ||
@@ -9,2 +9,6 @@ function useWorkspace(workspaceRoot) { | ||
exports.useWorkspace = useWorkspace; | ||
function usePackageJson(packageJson) { | ||
_context = Object.assign(Object.assign({}, _context), { packageJson }); | ||
} | ||
exports.usePackageJson = usePackageJson; | ||
function getConfigContext() { | ||
@@ -11,0 +15,0 @@ return _context; |
@@ -150,12 +150,9 @@ "use strict"; | ||
function shareAll(config = {}, skip = default_skip_list_1.DEFAULT_SKIP_LIST, projectPath = '') { | ||
var _a; | ||
let workspacePath = undefined; | ||
if (!projectPath) { | ||
projectPath = (0, process_1.cwd)(); | ||
} | ||
workspacePath = (_a = (0, configuration_context_1.getConfigContext)().workspaceRoot) !== null && _a !== void 0 ? _a : ''; | ||
if (!workspacePath) { | ||
workspacePath = projectPath; | ||
} | ||
const versionMaps = (0, package_info_1.getVersionMaps)(projectPath, workspacePath); | ||
// let workspacePath: string | undefined = undefined; | ||
projectPath = inferProjectPath(projectPath); | ||
// workspacePath = getConfigContext().workspaceRoot ?? ''; | ||
// if (!workspacePath) { | ||
// workspacePath = projectPath; | ||
// } | ||
const versionMaps = (0, package_info_1.getVersionMaps)(projectPath, projectPath); | ||
const share = {}; | ||
@@ -180,2 +177,14 @@ for (const versions of versionMaps) { | ||
exports.shareAll = shareAll; | ||
function inferProjectPath(projectPath) { | ||
if (!projectPath && (0, configuration_context_1.getConfigContext)().packageJson) { | ||
projectPath = path.dirname((0, configuration_context_1.getConfigContext)().packageJson || ''); | ||
} | ||
if (!projectPath && (0, configuration_context_1.getConfigContext)().workspaceRoot) { | ||
projectPath = (0, configuration_context_1.getConfigContext)().workspaceRoot || ''; | ||
} | ||
if (!projectPath) { | ||
projectPath = (0, process_1.cwd)(); | ||
} | ||
return projectPath; | ||
} | ||
function setInferVersion(infer) { | ||
@@ -186,5 +195,3 @@ inferVersion = infer; | ||
function share(shareObjects, projectPath = '') { | ||
if (!projectPath) { | ||
projectPath = (0, process_1.cwd)(); | ||
} | ||
projectPath = inferProjectPath(projectPath); | ||
const packagePath = findPackageJson(projectPath); | ||
@@ -191,0 +198,0 @@ // const versions = readVersionMap(packagePath); |
@@ -15,5 +15,8 @@ "use strict"; | ||
const result = []; | ||
const folder = fedOptions.packageJson ? | ||
path.dirname(fedOptions.packageJson) : | ||
fedOptions.workspaceRoot; | ||
const packageInfos = Object.keys(config.shared) | ||
// .filter((packageName) => !isInSkipList(packageName, PREPARED_DEFAULT_SKIP_LIST)) | ||
.map((packageName) => (0, package_info_1.getPackageInfo)(packageName, fedOptions.workspaceRoot)) | ||
.map((packageName) => (0, package_info_1.getPackageInfo)(packageName, folder)) | ||
.filter((pi) => !!pi); | ||
@@ -20,0 +23,0 @@ // logger.notice('Shared packages are only bundled once as they are cached'); |
@@ -19,2 +19,3 @@ "use strict"; | ||
(0, configuration_context_1.useWorkspace)(params.options.workspaceRoot); | ||
(0, configuration_context_1.usePackageJson)(params.options.packageJson); | ||
config = yield (0, load_federation_config_1.loadFederationConfig)(fedOptions); | ||
@@ -21,0 +22,0 @@ params.options.workspaceRoot = (_a = (0, configuration_context_1.getConfigContext)().workspaceRoot) !== null && _a !== void 0 ? _a : params.options.workspaceRoot; |
@@ -9,2 +9,3 @@ export interface FederationOptions { | ||
watch?: boolean; | ||
packageJson?: string; | ||
} |
@@ -100,3 +100,3 @@ "use strict"; | ||
function _getPackageInfo(packageName, directory) { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
const mainPkgName = getPkgFolder(packageName); | ||
@@ -153,3 +153,14 @@ const mainPkgJsonPath = findDepPackageJson(packageName, directory); | ||
} | ||
cand = (_e = (_d = mainPkgJson === null || mainPkgJson === void 0 ? void 0 : mainPkgJson.exports) === null || _d === void 0 ? void 0 : _d[relSecondaryPath]) === null || _e === void 0 ? void 0 : _e.default; | ||
cand = (_e = (_d = mainPkgJson === null || mainPkgJson === void 0 ? void 0 : mainPkgJson.exports) === null || _d === void 0 ? void 0 : _d[relSecondaryPath]) === null || _e === void 0 ? void 0 : _e.module; | ||
if (typeof cand === 'object') { | ||
if (cand.module) { | ||
cand = cand.module; | ||
} | ||
else if (cand.default) { | ||
cand = cand.default; | ||
} | ||
else { | ||
cand = null; | ||
} | ||
} | ||
if (cand) { | ||
@@ -163,2 +174,11 @@ return { | ||
} | ||
cand = (_g = (_f = mainPkgJson === null || mainPkgJson === void 0 ? void 0 : mainPkgJson.exports) === null || _f === void 0 ? void 0 : _f[relSecondaryPath]) === null || _g === void 0 ? void 0 : _g.default; | ||
if (cand) { | ||
return { | ||
entryPoint: path.join(mainPkgPath, cand), | ||
packageName, | ||
version, | ||
esm, | ||
}; | ||
} | ||
cand = mainPkgJson['module']; | ||
@@ -165,0 +185,0 @@ if (cand && relSecondaryPath === '.') { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
116129
1405
368
2
+ Added@softarc/native-federation-runtime@1.1.1-beta.0(transitive)
- Removed@softarc/native-federation-runtime@1.1.0(transitive)