@module-federation/esbuild 0.0.0-next-20240523224941

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.
@@ -0,0 +1 @@
1
+ export * from '@module-federation/native-federation-runtime';
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@module-federation/esbuild",
3
+ "version": "0.0.1",
4
+ "author": "Zack Jackson (@ScriptedAlchemy)",
5
+ "main": "./index.cjs.js",
6
+ "module": "./index.esm.js",
7
+ "types": "./dist/index.cjs.d.ts",
8
+ "license": "MIT",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "files": [
13
+ "dist/",
14
+ "README.md"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.cjs.d.ts",
19
+ "import": "./dist/index.esm.js",
20
+ "require": "./dist/index.cjs.js"
21
+ },
22
+ "./esbuild-adapter": {
23
+ "types": "./dist/esbuild.cjs.d.ts",
24
+ "import": "./dist/esbuild.esm.js",
25
+ "require": "./dist/esbuild.cjs.js"
26
+ },
27
+ "./build": {
28
+ "types": "./dist/build.cjs.d.ts",
29
+ "import": "./dist/build.esm.js",
30
+ "require": "./dist/build.cjs.js"
31
+ },
32
+ "./types": {
33
+ "types": "./dist/types.cjs.d.ts",
34
+ "import": "./dist/types.esm.js",
35
+ "require": "./dist/types.cjs.js"
36
+ },
37
+ "./*": "./*"
38
+ },
39
+ "typesVersions": {
40
+ "*": {
41
+ ".": [
42
+ "./dist/index.cjs.d.ts"
43
+ ],
44
+ "helpers": [
45
+ "./dist/helpers.cjs.d.ts"
46
+ ],
47
+ "types": [
48
+ "./dist/types.cjs.d.ts"
49
+ ]
50
+ }
51
+ },
52
+ "dependencies": {
53
+ "enhanced-resolve": "^5.16.1",
54
+ "esm-cjs-lexer": "^0.10.0",
55
+ "cjs-module-lexer": "^1.3.1",
56
+ "@chialab/cjs-to-esm": "^0.18.0",
57
+ "@module-federation/sdk": "workspace:*",
58
+ "json5": "^2.2.3",
59
+ "@rollup/plugin-commonjs": "^22.0.2",
60
+ "@rollup/plugin-node-resolve": "^13.3.0",
61
+ "@rollup/plugin-replace": "^4.0.0",
62
+ "rollup": "^2.79.0",
63
+ "rollup-plugin-node-externals": "^4.1.1",
64
+ "esbuild": "^0.18.12",
65
+ "npmlog": "^6.0.2",
66
+ "acorn": "^8.8.1"
67
+ }
68
+ }
@@ -0,0 +1,19 @@
1
+ import { createRequire } from 'module';
2
+ import nodePath from 'path';
3
+ export default (path, options = {}) => {
4
+ const p = options.path || undefined;
5
+ const mode = options.mode || 'esm';
6
+ if (mode === 'cjs') {
7
+ const require = createRequire(import.meta.url);
8
+ if (!p) return require.resolve(path);
9
+ return require.resolve(path, { paths: [p] });
10
+ } else {
11
+ try {
12
+ return import.meta.resolve(path.join(p, path)).replace(/^file:\/\//, '');
13
+ } catch (e) {
14
+ const require = createRequire(import.meta.url);
15
+ if (!p) return require.resolve(path);
16
+ return require.resolve(path, { paths: [p] });
17
+ }
18
+ }
19
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,11 @@
1
+ export declare const resolve: (arg1: string, arg2: string) => Promise<string | false | undefined>;
2
+ export declare function getExports(modulePath: string): Promise<string[]>;
3
+ declare function collectExports(filePath: string): {
4
+ hasDefaultExport: boolean;
5
+ hasFurtherExports: boolean;
6
+ defaultExportName: string;
7
+ exports: string[];
8
+ };
9
+ declare function traverse(node: any, visit: (node: any) => void): void;
10
+ declare function isDefaultExport(exportSpecifier: any): boolean;
11
+ export { collectExports, traverse, isDefaultExport };
@@ -0,0 +1,5 @@
1
+ import { PluginBuild } from 'esbuild';
2
+ export declare const createContainerPlugin: (config: any) => {
3
+ name: string;
4
+ setup(build: PluginBuild): void;
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const buildFederationHost: () => string;
2
+ export declare const initializeHostPlugin: {
3
+ name: string;
4
+ setup(build: any): void;
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const createVirtualRemoteModule: (name: string, ref: string) => string;
2
+ export declare const linkRemotesPlugin: {
3
+ name: string;
4
+ setup(build: any): void;
5
+ };
@@ -0,0 +1,17 @@
1
+ interface BuildResult {
2
+ errors?: any[];
3
+ metafile: {
4
+ outputs: Record<string, OutputFile>;
5
+ };
6
+ }
7
+ interface OutputFile {
8
+ entryPoint?: string;
9
+ imports?: {
10
+ path: string;
11
+ }[];
12
+ exports?: string[];
13
+ kind: string;
14
+ chunk: string;
15
+ }
16
+ export declare const writeRemoteManifest: (config: any, result: BuildResult) => Promise<void>;
17
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PluginBuild } from 'esbuild';
2
+ export declare const createVirtualShareModule: (name: string, ref: string, exports: string[]) => string;
3
+ export declare const createVirtualRemoteModule: (name: string, ref: string) => string;
4
+ export declare const moduleFederationPlugin: (config: any) => {
5
+ name: string;
6
+ setup(build: PluginBuild): void;
7
+ };
@@ -0,0 +1 @@
1
+ export declare const createContainerCode = "\nimport bundler_runtime_base from '@module-federation/webpack-bundler-runtime';\n// import instantiatePatch from \"./federation.js\";\n\nconst createContainer = (federationOptions) => {\n // await instantiatePatch(federationOptions, true);\n const {exposes, name, remotes = [], shared, plugins} = federationOptions;\n\n const __webpack_modules__ = {\n \"./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js\": (module, __webpack_exports__, __webpack_require__) => {\n __webpack_require__.r(__webpack_exports__);\n const bundler_runtime = __webpack_require__.n(bundler_runtime_base);\n const prevFederation = __webpack_require__.federation;\n __webpack_require__.federation = {};\n for (const key in bundler_runtime()) {\n __webpack_require__.federation[key] = bundler_runtime()[key];\n }\n for (const key in prevFederation) {\n __webpack_require__.federation[key] = prevFederation[key];\n }\n if (!__webpack_require__.federation.instance) {\n const pluginsToAdd = plugins || [];\n __webpack_require__.federation.initOptions.plugins = __webpack_require__.federation.initOptions.plugins ?\n __webpack_require__.federation.initOptions.plugins.concat(pluginsToAdd) : pluginsToAdd;\n __webpack_require__.federation.instance = __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);\n if (__webpack_require__.federation.attachShareScopeMap) {\n __webpack_require__.federation.attachShareScopeMap(__webpack_require__);\n }\n if (__webpack_require__.federation.installInitialConsumes) {\n __webpack_require__.federation.installInitialConsumes();\n }\n }\n },\n\n \"webpack/container/entry/createContainer\": (module, exports, __webpack_require__) => {\n const moduleMap = {};\n for (const key in exposes) {\n if (Object.prototype.hasOwnProperty.call(exposes, key)) {\n moduleMap[key] = () => Promise.resolve(exposes[key]()).then(m => () => m);\n }\n }\n\n const get = (module, getScope) => {\n __webpack_require__.R = getScope;\n getScope = (\n __webpack_require__.o(moduleMap, module)\n ? moduleMap[module]()\n : Promise.resolve().then(() => {\n throw new Error(\"Module '\" + module + \"' does not exist in container.\");\n })\n );\n __webpack_require__.R = undefined;\n return getScope;\n };\n const init = (shareScope, initScope, remoteEntryInitOptions) => {\n return __webpack_require__.federation.bundlerRuntime.initContainerEntry({\n webpackRequire: __webpack_require__,\n shareScope: shareScope,\n initScope: initScope,\n remoteEntryInitOptions: remoteEntryInitOptions,\n shareScopeKey: \"default\"\n });\n };\n __webpack_require__(\"./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js\");\n\n // This exports getters to disallow modifications\n __webpack_require__.d(exports, {\n get: () => get,\n init: () => init,\n moduleMap: () => moduleMap,\n });\n }\n };\n\n const __webpack_module_cache__ = {};\n\n const __webpack_require__ = (moduleId) => {\n let cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== undefined) {\n return cachedModule.exports;\n }\n let module = __webpack_module_cache__[moduleId] = {\n id: moduleId,\n loaded: false,\n exports: {}\n };\n\n const execOptions = {\n id: moduleId,\n module: module,\n factory: __webpack_modules__[moduleId],\n require: __webpack_require__\n };\n __webpack_require__.i.forEach(handler => {\n handler(execOptions);\n });\n module = execOptions.module;\n execOptions.factory.call(module.exports, module, module.exports, execOptions.require);\n\n module.loaded = true;\n\n return module.exports;\n };\n\n __webpack_require__.m = __webpack_modules__;\n __webpack_require__.c = __webpack_module_cache__;\n __webpack_require__.i = [];\n\n if (!__webpack_require__.federation) {\n __webpack_require__.federation = {\n initOptions: {\n \"name\": name,\n \"remotes\": remotes.map(remote => ({\n \"type\": remote.type,\n \"alias\": remote.alias,\n \"name\": remote.name,\n \"entry\": remote.entry,\n \"shareScope\": remote.shareScope || \"default\"\n }))\n },\n chunkMatcher: () => true,\n rootOutputDir: \"\",\n initialConsumes: undefined,\n bundlerRuntimeOptions: {}\n };\n }\n\n __webpack_require__.n = (module) => {\n const getter = module && module.__esModule ? () => module['default'] : () => module;\n __webpack_require__.d(getter, {a: getter});\n return getter;\n };\n\n __webpack_require__.d = (exports, definition) => {\n for (const key in definition) {\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {enumerable: true, get: definition[key]});\n }\n }\n };\n\n __webpack_require__.f = {};\n\n __webpack_require__.g = (() => {\n if (typeof globalThis === 'object') return globalThis;\n try {\n return this || new Function('return this')();\n } catch (e) {\n if (typeof window === 'object') return window;\n }\n })();\n\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n\n __webpack_require__.r = (exports) => {\n if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'});\n }\n Object.defineProperty(exports, '__esModule', {value: true});\n };\n\n __webpack_require__.federation.initOptions.shared = shared;\n __webpack_require__.S = {};\n const initPromises = {};\n const initTokens = {};\n __webpack_require__.I = (name, initScope) => {\n return __webpack_require__.federation.bundlerRuntime.I({\n shareScopeName: name,\n webpackRequire: __webpack_require__,\n initPromises: initPromises,\n initTokens: initTokens,\n initScope: initScope,\n });\n };\n\n const __webpack_exports__ = __webpack_require__(\"webpack/container/entry/createContainer\");\n const __webpack_exports__get = __webpack_exports__.get;\n const __webpack_exports__init = __webpack_exports__.init;\n const __webpack_exports__moduleMap = __webpack_exports__.moduleMap;\n return __webpack_exports__;\n}";
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@module-federation/esbuild",
3
+ "version": "0.0.0-next-20240523224941",
4
+ "author": "Zack Jackson (@ScriptedAlchemy)",
5
+ "main": "./dist/index.cjs.js",
6
+ "module": "./dist/index.esm.js",
7
+ "types": "./dist/index.cjs.d.ts",
8
+ "license": "MIT",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "files": [
13
+ "dist/",
14
+ "README.md"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.cjs.d.ts",
19
+ "import": "./dist/index.esm.js",
20
+ "require": "./dist/index.cjs.js"
21
+ },
22
+ "./esbuild-adapter": {
23
+ "types": "./dist/esbuild.cjs.d.ts",
24
+ "import": "./dist/esbuild.esm.js",
25
+ "require": "./dist/esbuild.cjs.js"
26
+ },
27
+ "./build": {
28
+ "types": "./dist/build.cjs.d.ts",
29
+ "import": "./dist/build.esm.js",
30
+ "require": "./dist/build.cjs.js"
31
+ },
32
+ "./types": {
33
+ "types": "./dist/types.cjs.d.ts",
34
+ "import": "./dist/types.esm.js",
35
+ "require": "./dist/types.cjs.js"
36
+ },
37
+ "./*": "./*"
38
+ },
39
+ "typesVersions": {
40
+ "*": {
41
+ ".": [
42
+ "./dist/index.cjs.d.ts"
43
+ ],
44
+ "helpers": [
45
+ "./dist/helpers.cjs.d.ts"
46
+ ],
47
+ "types": [
48
+ "./dist/types.cjs.d.ts"
49
+ ]
50
+ }
51
+ },
52
+ "dependencies": {
53
+ "enhanced-resolve": "^5.16.1",
54
+ "esm-cjs-lexer": "^0.10.0",
55
+ "cjs-module-lexer": "^1.3.1",
56
+ "@chialab/cjs-to-esm": "^0.18.0",
57
+ "json5": "^2.2.3",
58
+ "@rollup/plugin-commonjs": "^22.0.2",
59
+ "@rollup/plugin-node-resolve": "^13.3.0",
60
+ "@rollup/plugin-replace": "^4.0.0",
61
+ "rollup": "^2.79.0",
62
+ "rollup-plugin-node-externals": "^4.1.1",
63
+ "esbuild": "^0.18.12",
64
+ "npmlog": "^6.0.2",
65
+ "acorn": "^8.8.1",
66
+ "@module-federation/sdk": "0.0.0-next-20240523224941"
67
+ }
68
+ }