@module-federation/esbuild 0.0.0-next-20240528203231 → 0.0.0-next-20240529015908
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/build.cjs.js +62 -654
- package/dist/build.esm.js +62 -639
- package/dist/get-externals.cjs.js +6 -5
- package/dist/get-externals.esm.js +6 -5
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +2 -11
- package/dist/index.esm.js +3 -1
- package/dist/package.json +3 -3
- package/dist/plugin.cjs.d.ts +1 -0
- package/dist/{esbuild.cjs.js → plugin.cjs.js} +23 -210
- package/dist/{esbuild.esm.js → plugin.esm.js} +18 -205
- package/dist/src/adapters/lib/react-replacements.d.ts +9 -0
- package/dist/src/build.d.ts +5 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/lib/config/configuration-context.d.ts +7 -0
- package/dist/src/lib/config/federation-config.d.ts +30 -0
- package/dist/src/lib/config/share-utils.d.ts +29 -0
- package/dist/src/lib/config/with-native-federation.d.ts +23 -0
- package/dist/src/lib/core/build-adapter.d.ts +4 -0
- package/dist/src/lib/core/default-skip-list.d.ts +12 -0
- package/dist/src/lib/core/federation-options.d.ts +10 -0
- package/dist/src/lib/core/get-externals.d.ts +2 -0
- package/dist/src/lib/core/load-federation-config.d.ts +6 -0
- package/dist/src/lib/core/write-federation-info.d.ts +9 -0
- package/dist/src/lib/utils/logger.d.ts +11 -0
- package/dist/src/lib/utils/mapped-paths.d.ts +10 -0
- package/dist/src/lib/utils/normalize.d.ts +1 -0
- package/dist/src/lib/utils/package-info.d.ts +18 -0
- package/package.json +5 -5
- package/dist/esbuild.cjs.d.ts +0 -2
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
import esbuild$1 from 'esbuild';
|
|
2
|
-
import { rollup } from 'rollup';
|
|
3
|
-
import pluginNodeResolve from '@rollup/plugin-node-resolve';
|
|
4
|
-
import { externals } from 'rollup-plugin-node-externals';
|
|
5
1
|
import fs__default from 'fs';
|
|
6
|
-
import path__default from 'path';
|
|
7
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
8
|
-
import replace from '@rollup/plugin-replace';
|
|
9
2
|
import { init, parse as parse$1 } from 'es-module-lexer';
|
|
10
3
|
import { init as init$1, parse } from 'cjs-module-lexer';
|
|
11
4
|
import { promisify } from 'util';
|
|
12
5
|
import enhancedResolve from 'enhanced-resolve';
|
|
6
|
+
import path__default from 'path';
|
|
13
7
|
import { g as getExternals } from './get-externals.esm.js';
|
|
14
8
|
|
|
15
|
-
function getAugmentedNamespace(n) {
|
|
16
|
-
if (n.__esModule) return n;
|
|
17
|
-
var a = Object.defineProperty({}, '__esModule', {
|
|
18
|
-
value: true
|
|
19
|
-
});
|
|
20
|
-
Object.keys(n).forEach(function(k) {
|
|
21
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
22
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return n[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
return a;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
9
|
const resolve = promisify(enhancedResolve.create({
|
|
33
10
|
mainFields: [
|
|
34
11
|
'browser',
|
|
@@ -74,8 +51,8 @@ async function getExports(modulePath) {
|
|
|
74
51
|
|
|
75
52
|
var version = "0.0.1";
|
|
76
53
|
|
|
77
|
-
function _extends$
|
|
78
|
-
_extends$
|
|
54
|
+
function _extends$1() {
|
|
55
|
+
_extends$1 = Object.assign || function(target) {
|
|
79
56
|
for(var i = 1; i < arguments.length; i++){
|
|
80
57
|
var source = arguments[i];
|
|
81
58
|
for(var key in source){
|
|
@@ -86,7 +63,7 @@ function _extends$2() {
|
|
|
86
63
|
}
|
|
87
64
|
return target;
|
|
88
65
|
};
|
|
89
|
-
return _extends$
|
|
66
|
+
return _extends$1.apply(this, arguments);
|
|
90
67
|
}
|
|
91
68
|
const writeRemoteManifest = async (config, result)=>{
|
|
92
69
|
var _result_metafile, _result_metafile1;
|
|
@@ -113,7 +90,7 @@ const writeRemoteManifest = async (config, result)=>{
|
|
|
113
90
|
if (key.startsWith('container:') && key.endsWith(config.filename)) {
|
|
114
91
|
containerName = key;
|
|
115
92
|
}
|
|
116
|
-
acc[key] = _extends$
|
|
93
|
+
acc[key] = _extends$1({}, chunkValue, {
|
|
117
94
|
chunk: chunkKey
|
|
118
95
|
});
|
|
119
96
|
return acc;
|
|
@@ -123,7 +100,7 @@ const writeRemoteManifest = async (config, result)=>{
|
|
|
123
100
|
const { entryPoint } = chunkValue;
|
|
124
101
|
const key = entryPoint || chunkKey;
|
|
125
102
|
const trimKey = key.substring(0, key.lastIndexOf('.')) || key;
|
|
126
|
-
acc[trimKey] = _extends$
|
|
103
|
+
acc[trimKey] = _extends$1({}, chunkValue, {
|
|
127
104
|
chunk: chunkKey
|
|
128
105
|
});
|
|
129
106
|
return acc;
|
|
@@ -732,7 +709,7 @@ const initializeHostPlugin = (config)=>({
|
|
|
732
709
|
});
|
|
733
710
|
|
|
734
711
|
// relys on import map since i dont know the named exports of a remote to return.
|
|
735
|
-
const createVirtualRemoteModule = (name, ref)=>`
|
|
712
|
+
const createVirtualRemoteModule$1 = (name, ref)=>`
|
|
736
713
|
export * from ${JSON.stringify('federationRemote/' + ref)}
|
|
737
714
|
`;
|
|
738
715
|
const linkRemotesPlugin = (config)=>({
|
|
@@ -766,7 +743,7 @@ const linkRemotesPlugin = (config)=>({
|
|
|
766
743
|
namespace: 'remote-module'
|
|
767
744
|
}, async (args)=>{
|
|
768
745
|
return {
|
|
769
|
-
contents: createVirtualRemoteModule(config.name, args.path),
|
|
746
|
+
contents: createVirtualRemoteModule$1(config.name, args.path),
|
|
770
747
|
loader: 'js',
|
|
771
748
|
resolveDir: path__default.dirname(args.path)
|
|
772
749
|
};
|
|
@@ -774,8 +751,8 @@ const linkRemotesPlugin = (config)=>({
|
|
|
774
751
|
}
|
|
775
752
|
});
|
|
776
753
|
|
|
777
|
-
function _extends
|
|
778
|
-
_extends
|
|
754
|
+
function _extends() {
|
|
755
|
+
_extends = Object.assign || function(target) {
|
|
779
756
|
for(var i = 1; i < arguments.length; i++){
|
|
780
757
|
var source = arguments[i];
|
|
781
758
|
for(var key in source){
|
|
@@ -786,7 +763,7 @@ function _extends$1() {
|
|
|
786
763
|
}
|
|
787
764
|
return target;
|
|
788
765
|
};
|
|
789
|
-
return _extends
|
|
766
|
+
return _extends.apply(this, arguments);
|
|
790
767
|
}
|
|
791
768
|
// Creates a virtual module for sharing dependencies
|
|
792
769
|
const createVirtualShareModule = (name, ref, exports)=>`
|
|
@@ -796,6 +773,9 @@ const createVirtualShareModule = (name, ref, exports)=>`
|
|
|
796
773
|
|
|
797
774
|
${exports.map((e)=>e === 'default' ? `export default mfLsZJ92.default` : `export const ${e} = mfLsZJ92[${JSON.stringify(e)}];`).join('\n')}
|
|
798
775
|
`;
|
|
776
|
+
const createVirtualRemoteModule = (name, ref)=>`
|
|
777
|
+
export * from ${JSON.stringify('federationRemote/' + ref)}
|
|
778
|
+
`;
|
|
799
779
|
// Plugin to transform CommonJS modules to ESM
|
|
800
780
|
const cjsToEsmPlugin = {
|
|
801
781
|
name: 'cjs-to-esm',
|
|
@@ -818,7 +798,7 @@ const cjsToEsmPlugin = {
|
|
|
818
798
|
contents: code,
|
|
819
799
|
loader: 'js',
|
|
820
800
|
resolveDir: path__default.dirname(resolver),
|
|
821
|
-
pluginData: _extends
|
|
801
|
+
pluginData: _extends({}, args.pluginData, {
|
|
822
802
|
path: resolver
|
|
823
803
|
})
|
|
824
804
|
};
|
|
@@ -828,7 +808,7 @@ const cjsToEsmPlugin = {
|
|
|
828
808
|
contents: fileContent,
|
|
829
809
|
loader: 'js',
|
|
830
810
|
resolveDir: path__default.dirname(resolver),
|
|
831
|
-
pluginData: _extends
|
|
811
|
+
pluginData: _extends({}, args.pluginData, {
|
|
832
812
|
path: resolver
|
|
833
813
|
})
|
|
834
814
|
};
|
|
@@ -964,7 +944,7 @@ const moduleFederationPlugin = (config)=>({
|
|
|
964
944
|
const key = entryPoint || chunkKey;
|
|
965
945
|
const trimKey = key.substring(0, key.lastIndexOf('.')) || key;
|
|
966
946
|
//@ts-ignore
|
|
967
|
-
acc[trimKey] = _extends
|
|
947
|
+
acc[trimKey] = _extends({}, chunkValue, {
|
|
968
948
|
chunk: chunkKey
|
|
969
949
|
});
|
|
970
950
|
return acc;
|
|
@@ -995,171 +975,4 @@ const moduleFederationPlugin = (config)=>({
|
|
|
995
975
|
}
|
|
996
976
|
});
|
|
997
977
|
|
|
998
|
-
|
|
999
|
-
_extends = Object.assign || function(target) {
|
|
1000
|
-
for(var i = 1; i < arguments.length; i++){
|
|
1001
|
-
var source = arguments[i];
|
|
1002
|
-
for(var key in source){
|
|
1003
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1004
|
-
target[key] = source[key];
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
return target;
|
|
1009
|
-
};
|
|
1010
|
-
return _extends.apply(this, arguments);
|
|
1011
|
-
}
|
|
1012
|
-
function createEsBuildAdapter(config) {
|
|
1013
|
-
if (!config.compensateExports) {
|
|
1014
|
-
config.compensateExports = [
|
|
1015
|
-
new RegExp('/react/')
|
|
1016
|
-
];
|
|
1017
|
-
}
|
|
1018
|
-
return async (options)=>{
|
|
1019
|
-
const { entryPoints, external, outdir, hash, packageInfos, name, plugins = [] } = options;
|
|
1020
|
-
// TODO: Do we need to prepare packages anymore as esbuild has evolved?
|
|
1021
|
-
for (const entryPoint of entryPoints){
|
|
1022
|
-
const isPkg = entryPoint.fileName.includes('node_modules');
|
|
1023
|
-
const pkgName = isPkg ? inferePkgName(entryPoint.fileName) : '';
|
|
1024
|
-
const tmpFolder = `node_modules/.tmp/${pkgName}`;
|
|
1025
|
-
if (isPkg) {
|
|
1026
|
-
await prepareNodePackage(entryPoint.fileName, external, tmpFolder, config, !!options.dev, name);
|
|
1027
|
-
entryPoint.fileName = tmpFolder;
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
const ctx = await esbuild$1.context({
|
|
1031
|
-
entryPoints: entryPoints.map((ep)=>({
|
|
1032
|
-
in: ep.fileName,
|
|
1033
|
-
out: path__default.parse(ep.outName).name
|
|
1034
|
-
})),
|
|
1035
|
-
write: false,
|
|
1036
|
-
outdir,
|
|
1037
|
-
entryNames: '[name]',
|
|
1038
|
-
external,
|
|
1039
|
-
loader: config.loader,
|
|
1040
|
-
bundle: true,
|
|
1041
|
-
splitting: true,
|
|
1042
|
-
sourcemap: options.dev,
|
|
1043
|
-
minify: !options.dev,
|
|
1044
|
-
format: 'esm',
|
|
1045
|
-
target: [
|
|
1046
|
-
'esnext'
|
|
1047
|
-
],
|
|
1048
|
-
plugins: [
|
|
1049
|
-
...config.plugins,
|
|
1050
|
-
...plugins
|
|
1051
|
-
],
|
|
1052
|
-
metafile: true,
|
|
1053
|
-
define: {
|
|
1054
|
-
MF_CURRENT_HOST: JSON.stringify(name)
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
const result = await ctx.rebuild();
|
|
1058
|
-
result.outputFiles = result.outputFiles.reduce((acc, file, index)=>{
|
|
1059
|
-
const sharedPack = packageInfos ? packageInfos[index] : null;
|
|
1060
|
-
if (!sharedPack) {
|
|
1061
|
-
acc.push(file);
|
|
1062
|
-
return acc;
|
|
1063
|
-
}
|
|
1064
|
-
const fileName = path__default.basename(file.path);
|
|
1065
|
-
const filePath = path__default.join(outdir, fileName);
|
|
1066
|
-
const relative = path__default.relative(process.cwd(), file.path);
|
|
1067
|
-
const metadata = result.metafile.outputs[relative];
|
|
1068
|
-
const replc = filePath.replace(filePath, 'mf_' + fileName);
|
|
1069
|
-
acc.push(_extends({}, file, {
|
|
1070
|
-
path: replc
|
|
1071
|
-
}));
|
|
1072
|
-
const vm = createVirtualShareModule(name, sharedPack.packageName, metadata.exports);
|
|
1073
|
-
acc.push(_extends({}, file, {
|
|
1074
|
-
contents: vm
|
|
1075
|
-
}));
|
|
1076
|
-
return acc;
|
|
1077
|
-
}, []);
|
|
1078
|
-
const writtenFiles = writeResult(result, outdir);
|
|
1079
|
-
ctx.dispose();
|
|
1080
|
-
return writtenFiles.map((fileName)=>({
|
|
1081
|
-
fileName
|
|
1082
|
-
}));
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
function writeResult(result, outdir) {
|
|
1086
|
-
const outputFiles = result.outputFiles || [];
|
|
1087
|
-
const writtenFiles = [];
|
|
1088
|
-
for (const outFile of outputFiles){
|
|
1089
|
-
const fileName = path__default.basename(outFile.path);
|
|
1090
|
-
const filePath = path__default.join(outdir, fileName);
|
|
1091
|
-
fs__default.mkdirSync(path__default.dirname(filePath), {
|
|
1092
|
-
recursive: true
|
|
1093
|
-
});
|
|
1094
|
-
fs__default.writeFileSync(filePath, outFile.contents);
|
|
1095
|
-
writtenFiles.push(filePath);
|
|
1096
|
-
}
|
|
1097
|
-
return writtenFiles;
|
|
1098
|
-
}
|
|
1099
|
-
async function prepareNodePackage(entryPoint, external, tmpFolder, config, dev, name) {
|
|
1100
|
-
if (config.fileReplacements) {
|
|
1101
|
-
entryPoint = replaceEntryPoint(entryPoint, normalize(config.fileReplacements));
|
|
1102
|
-
}
|
|
1103
|
-
const env = dev ? 'development' : 'production';
|
|
1104
|
-
const result = await rollup({
|
|
1105
|
-
input: entryPoint,
|
|
1106
|
-
plugins: [
|
|
1107
|
-
commonjs(),
|
|
1108
|
-
externals({
|
|
1109
|
-
include: external
|
|
1110
|
-
}),
|
|
1111
|
-
pluginNodeResolve(),
|
|
1112
|
-
replace({
|
|
1113
|
-
true: true,
|
|
1114
|
-
values: {
|
|
1115
|
-
'process.env.NODE_ENV': `"${env}"`,
|
|
1116
|
-
MF_CURRENT_HOST: JSON.stringify(name)
|
|
1117
|
-
}
|
|
1118
|
-
})
|
|
1119
|
-
]
|
|
1120
|
-
});
|
|
1121
|
-
await result.write({
|
|
1122
|
-
format: 'esm',
|
|
1123
|
-
file: tmpFolder,
|
|
1124
|
-
sourcemap: dev,
|
|
1125
|
-
exports: 'named'
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
function inferePkgName(entryPoint) {
|
|
1129
|
-
return entryPoint.replace(/.*?node_modules/g, '').replace(/[^A-Za-z0-9.]/g, '_');
|
|
1130
|
-
}
|
|
1131
|
-
function normalize(config) {
|
|
1132
|
-
const result = {};
|
|
1133
|
-
for(const key in config){
|
|
1134
|
-
if (typeof config[key] === 'string') {
|
|
1135
|
-
result[key] = {
|
|
1136
|
-
file: config[key]
|
|
1137
|
-
};
|
|
1138
|
-
} else {
|
|
1139
|
-
result[key] = config[key];
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return result;
|
|
1143
|
-
}
|
|
1144
|
-
function replaceEntryPoint(entryPoint, fileReplacements) {
|
|
1145
|
-
entryPoint = entryPoint.replace(/\\/g, '/');
|
|
1146
|
-
for(const key in fileReplacements){
|
|
1147
|
-
entryPoint = entryPoint.replace(new RegExp(`${key}$`), fileReplacements[key].file);
|
|
1148
|
-
}
|
|
1149
|
-
return entryPoint;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
var adapter = /*#__PURE__*/Object.freeze({
|
|
1153
|
-
__proto__: null,
|
|
1154
|
-
createEsBuildAdapter: createEsBuildAdapter,
|
|
1155
|
-
getExports: getExports,
|
|
1156
|
-
resolve: resolve,
|
|
1157
|
-
moduleFederationPlugin: moduleFederationPlugin
|
|
1158
|
-
});
|
|
1159
|
-
|
|
1160
|
-
var require$$0 = /*@__PURE__*/ getAugmentedNamespace(adapter);
|
|
1161
|
-
|
|
1162
|
-
const Adapter = require$$0;
|
|
1163
|
-
var esbuild = Adapter;
|
|
1164
|
-
|
|
1165
|
-
export { esbuild as default };
|
|
978
|
+
export { createVirtualRemoteModule, createVirtualShareModule, moduleFederationPlugin };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ConfigurationContext {
|
|
2
|
+
workspaceRoot?: string;
|
|
3
|
+
packageJson?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function useWorkspace(workspaceRoot: string): void;
|
|
6
|
+
export declare function usePackageJson(packageJson: string): void;
|
|
7
|
+
export declare function getConfigContext(): ConfigurationContext;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SkipList } from '../core/default-skip-list';
|
|
2
|
+
export interface SharedConfig {
|
|
3
|
+
singleton?: boolean;
|
|
4
|
+
strictVersion?: boolean;
|
|
5
|
+
requiredVersion?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
includeSecondaries?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FederationConfig {
|
|
10
|
+
name?: string;
|
|
11
|
+
exposes?: Record<string, string>;
|
|
12
|
+
shared?: Record<string, SharedConfig>;
|
|
13
|
+
sharedMappings?: Array<string>;
|
|
14
|
+
skip?: SkipList;
|
|
15
|
+
}
|
|
16
|
+
export interface NormalizedSharedConfig {
|
|
17
|
+
singleton: boolean;
|
|
18
|
+
strictVersion: boolean;
|
|
19
|
+
requiredVersion: string;
|
|
20
|
+
version?: string;
|
|
21
|
+
eager?: boolean;
|
|
22
|
+
includeSecondaries?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface NormalizedFederationConfig {
|
|
25
|
+
name: string;
|
|
26
|
+
filename?: string;
|
|
27
|
+
exposes?: Record<string, string>;
|
|
28
|
+
shared?: Record<string, NormalizedSharedConfig>;
|
|
29
|
+
remotes?: Record<string, string>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SharedConfig } from './federation-config';
|
|
2
|
+
import { SkipListEntry } from '../core/default-skip-list';
|
|
3
|
+
type IncludeSecondariesOptions = {
|
|
4
|
+
skip: string | string[];
|
|
5
|
+
} | boolean;
|
|
6
|
+
type CustomSharedConfig = SharedConfig & {
|
|
7
|
+
includeSecondaries?: IncludeSecondariesOptions;
|
|
8
|
+
};
|
|
9
|
+
type ConfigObject = Record<string, CustomSharedConfig>;
|
|
10
|
+
type Config = (string | ConfigObject)[] | ConfigObject;
|
|
11
|
+
export declare const DEFAULT_SECONARIES_SKIP_LIST: string[];
|
|
12
|
+
export declare function findRootTsConfigJson(): string;
|
|
13
|
+
export declare function findPackageJson(folder: string): string;
|
|
14
|
+
export declare function lookupVersion(key: string, workspaceRoot: string): string;
|
|
15
|
+
export declare function lookupVersionInMap(key: string, versions: Record<string, string>): string | null;
|
|
16
|
+
export declare function _findSecondaries(libPath: string, excludes: string[], shareObject: Record<string, any>, acc: Record<string, any>): void;
|
|
17
|
+
export declare function findSecondaries(libPath: string, excludes: string[], shareObject: Record<string, any>): Record<string, any>;
|
|
18
|
+
export declare function getSecondaries(includeSecondaries: boolean | {
|
|
19
|
+
skip?: string | string[];
|
|
20
|
+
}, libPath: string, key: string, shareObject: Record<string, any>): Record<string, any>;
|
|
21
|
+
export declare function readConfiguredSecondaries(parent: string, libPath: string, exclude: string[], shareObject: Record<string, any>): Record<string, any> | null;
|
|
22
|
+
export declare function getDefaultEntry(exports: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}, key: string): string;
|
|
25
|
+
export declare function shareAll(config: CustomSharedConfig, skip?: SkipListEntry[], projectPath?: string): Config;
|
|
26
|
+
export declare function setInferVersion(infer: boolean): void;
|
|
27
|
+
export declare function share(shareObjects: Record<string, any>, projectPath?: string): Record<string, any>;
|
|
28
|
+
export declare function addSecondaries(secondaries: Record<string, any>, result: Record<string, any>): void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface FederationConfig {
|
|
2
|
+
name?: string;
|
|
3
|
+
filename?: string;
|
|
4
|
+
exposes?: Record<string, string>;
|
|
5
|
+
remotes?: Record<string, string>;
|
|
6
|
+
shared?: Record<string, SharedConfig>;
|
|
7
|
+
skip?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface SharedConfig {
|
|
10
|
+
requiredVersion?: string;
|
|
11
|
+
singleton?: boolean;
|
|
12
|
+
strictVersion?: boolean;
|
|
13
|
+
version?: string;
|
|
14
|
+
includeSecondaries?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function withFederation(config: FederationConfig): {
|
|
17
|
+
name: string;
|
|
18
|
+
filename: string;
|
|
19
|
+
exposes: Record<string, string>;
|
|
20
|
+
remotes: Record<string, string>;
|
|
21
|
+
shared: Record<string, SharedConfig>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SkipFn = (name: string) => boolean;
|
|
2
|
+
export type SkipListEntry = string | RegExp | SkipFn;
|
|
3
|
+
export type SkipList = SkipListEntry[];
|
|
4
|
+
export type PreparedSkipList = {
|
|
5
|
+
strings: Set<string>;
|
|
6
|
+
functions: SkipFn[];
|
|
7
|
+
regexps: RegExp[];
|
|
8
|
+
};
|
|
9
|
+
export declare const DEFAULT_SKIP_LIST: SkipListEntry[];
|
|
10
|
+
export declare const PREPARED_DEFAULT_SKIP_LIST: PreparedSkipList;
|
|
11
|
+
export declare function prepareSkipList(skipList: SkipListEntry[]): PreparedSkipList;
|
|
12
|
+
export declare function isInSkipList(entry: string, skipList: PreparedSkipList): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface Logger {
|
|
2
|
+
error: (msg: string) => void;
|
|
3
|
+
warn: (msg: string) => void;
|
|
4
|
+
notice: (msg: string) => void;
|
|
5
|
+
info: (msg: string) => void;
|
|
6
|
+
verbose: (msg: string) => void;
|
|
7
|
+
debug: (msg: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const logger: Logger;
|
|
10
|
+
export declare const setLogLevel: (level: string) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface MappedPath {
|
|
2
|
+
key: string;
|
|
3
|
+
path: string;
|
|
4
|
+
}
|
|
5
|
+
export interface GetMappedPathsParams {
|
|
6
|
+
rootTsConfigPath: string;
|
|
7
|
+
sharedMappings?: string[];
|
|
8
|
+
rootPath?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function getMappedPaths({ rootTsConfigPath, sharedMappings, rootPath, }: GetMappedPathsParams): MappedPath[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalize(path: string, trailingSlash?: boolean): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface PackageJsonInfo {
|
|
2
|
+
content: any;
|
|
3
|
+
directory: string;
|
|
4
|
+
}
|
|
5
|
+
interface PackageInfo {
|
|
6
|
+
entryPoint: string;
|
|
7
|
+
packageName: string;
|
|
8
|
+
version: string;
|
|
9
|
+
esm: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function findPackageJsonFiles(project: string, workspace: string): string[];
|
|
12
|
+
export declare function expandFolders(child: string, parent: string): string[];
|
|
13
|
+
export declare function getPackageInfo(packageName: string, workspaceRoot: string): PackageInfo | null;
|
|
14
|
+
export declare function getVersionMaps(project: string, workspace: string): Record<string, string>[];
|
|
15
|
+
export declare function getPackageJsonFiles(project: string, workspace: string): PackageJsonInfo[];
|
|
16
|
+
export declare function findDepPackageJson(packageName: string, projectRoot: string): string | null;
|
|
17
|
+
export declare function _getPackageInfo(packageName: string, directory: string): PackageInfo | null;
|
|
18
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/esbuild",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240529015908",
|
|
4
4
|
"author": "Zack Jackson (@ScriptedAlchemy)",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"import": "./dist/index.esm.js",
|
|
20
20
|
"require": "./dist/index.cjs.js"
|
|
21
21
|
},
|
|
22
|
-
"./
|
|
22
|
+
"./plugin": {
|
|
23
23
|
"types": "./dist/esbuild.cjs.d.ts",
|
|
24
|
-
"import": "./dist/
|
|
25
|
-
"require": "./dist/
|
|
24
|
+
"import": "./dist/plugin.esm.js",
|
|
25
|
+
"require": "./dist/plugin.cjs.js"
|
|
26
26
|
},
|
|
27
27
|
"./build": {
|
|
28
28
|
"types": "./dist/build.cjs.d.ts",
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"esbuild": "^0.18.12",
|
|
66
66
|
"npmlog": "^6.0.2",
|
|
67
67
|
"acorn": "^8.8.1",
|
|
68
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
68
|
+
"@module-federation/sdk": "0.0.0-next-20240529015908"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/dist/esbuild.cjs.d.ts
DELETED