@module-federation/treeshake-server 2.6.0 → 2.8.0
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/dist/876.mjs +940 -0
- package/dist/app.d.ts +1 -1
- package/dist/frontend/adapter/index.js +12 -8
- package/dist/frontend/index.html +1 -1
- package/dist/frontend/static/css/index.513418ff5d.css +1 -0
- package/dist/frontend/static/js/637.b47e0403af.js +2 -0
- package/dist/frontend/static/js/async/427.dbb8b74259.js +2 -0
- package/dist/frontend/static/js/async/503.7bd056737e.js +12 -0
- package/dist/frontend/static/js/async/515.1b7f26d7ec.js +2 -0
- package/dist/frontend/static/js/index.ace3fa3d0e.js +88 -0
- package/dist/frontend/static/js/lib-react.7c43a84261.js +2 -0
- package/dist/frontend/static/js/{lib-router.949393cc.js → lib-router.5077a93d5a.js} +3 -3
- package/dist/http/routes/build.d.ts +1 -1
- package/dist/http/routes/index.d.ts +1 -1
- package/dist/http/routes/maintenance.d.ts +1 -1
- package/dist/http/routes/static.d.ts +1 -1
- package/dist/index.js +29 -27
- package/dist/index.mjs +1 -942
- package/dist/nodeServer.d.ts +1 -1
- package/dist/server.js +23 -21
- package/dist/server.mjs +11 -949
- package/package.json +5 -5
- package/dist/frontend/static/css/index.16175e0f.css +0 -1
- package/dist/frontend/static/js/465.8ad65aff.js +0 -2
- package/dist/frontend/static/js/async/538.91f59a63.js +0 -12
- package/dist/frontend/static/js/async/873.03a2ef6b.js +0 -2
- package/dist/frontend/static/js/async/987.89efa6cc.js +0 -2
- package/dist/frontend/static/js/index.3cfd4422.js +0 -88
- package/dist/frontend/static/js/lib-react.c59642e3.js +0 -2
- /package/dist/frontend/static/js/{465.8ad65aff.js.LICENSE.txt → 637.b47e0403af.js.LICENSE.txt} +0 -0
- /package/dist/frontend/static/js/async/{538.91f59a63.js.LICENSE.txt → 427.dbb8b74259.js.LICENSE.txt} +0 -0
- /package/dist/frontend/static/js/async/{987.89efa6cc.js.LICENSE.txt → 503.7bd056737e.js.LICENSE.txt} +0 -0
- /package/dist/frontend/static/js/{lib-react.c59642e3.js.LICENSE.txt → lib-react.7c43a84261.js.LICENSE.txt} +0 -0
- /package/dist/frontend/static/js/{lib-router.949393cc.js.LICENSE.txt → lib-router.5077a93d5a.js.LICENSE.txt} +0 -0
package/dist/index.js
CHANGED
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -22,7 +26,7 @@ var __webpack_require__ = {};
|
|
|
22
26
|
})();
|
|
23
27
|
(()=>{
|
|
24
28
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
30
|
value: 'Module'
|
|
27
31
|
});
|
|
28
32
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -33,13 +37,13 @@ var __webpack_require__ = {};
|
|
|
33
37
|
var __webpack_exports__ = {};
|
|
34
38
|
__webpack_require__.r(__webpack_exports__);
|
|
35
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
createApp: ()=>createApp,
|
|
37
|
-
LocalObjectStore: ()=>LocalObjectStore,
|
|
38
|
-
createLogger: ()=>createLogger,
|
|
39
|
-
createOssAdapterRegistry: ()=>createOssAdapterRegistry,
|
|
40
40
|
LocalAdapter: ()=>LocalAdapter,
|
|
41
|
+
LocalObjectStore: ()=>LocalObjectStore,
|
|
41
42
|
createAdapterDeps: ()=>createAdapterDeps,
|
|
42
43
|
createAdapterRegistry: ()=>createAdapterRegistry,
|
|
44
|
+
createApp: ()=>createApp,
|
|
45
|
+
createLogger: ()=>createLogger,
|
|
46
|
+
createOssAdapterRegistry: ()=>createOssAdapterRegistry,
|
|
43
47
|
createServer: ()=>createServer
|
|
44
48
|
});
|
|
45
49
|
const external_hono_namespaceObject = require("hono");
|
|
@@ -54,7 +58,7 @@ function createDiMiddleware(deps) {
|
|
|
54
58
|
const external_pino_namespaceObject = require("pino");
|
|
55
59
|
var external_pino_default = /*#__PURE__*/ __webpack_require__.n(external_pino_namespaceObject);
|
|
56
60
|
const createLogger = (opts)=>external_pino_default()({
|
|
57
|
-
level:
|
|
61
|
+
level: opts?.level ?? 'info',
|
|
58
62
|
formatters: {
|
|
59
63
|
level (label) {
|
|
60
64
|
return {
|
|
@@ -94,7 +98,7 @@ const normalizedKey = (name, v)=>`${name}@${v}`;
|
|
|
94
98
|
function normalizeConfig(config) {
|
|
95
99
|
const { shared, plugins, target, libraryType, hostName, uploadOptions } = config;
|
|
96
100
|
const commonNormalizedConfig = {
|
|
97
|
-
plugins:
|
|
101
|
+
plugins: plugins?.sort(([a], [b])=>a.localeCompare(b)) ?? [],
|
|
98
102
|
target: Array.isArray(target) ? [
|
|
99
103
|
...target
|
|
100
104
|
].sort() : [
|
|
@@ -376,7 +380,6 @@ const retrieveSharedFilepaths = async (projectDir, type)=>{
|
|
|
376
380
|
stats.shared.forEach((s)=>{
|
|
377
381
|
const { name, version, fallback, fallbackName } = s;
|
|
378
382
|
if (fallback && fallbackName) {
|
|
379
|
-
var _s_usedExports;
|
|
380
383
|
const filepath = external_node_path_default().join(distDir, fallback);
|
|
381
384
|
sharedFilepaths.push({
|
|
382
385
|
name,
|
|
@@ -385,7 +388,7 @@ const retrieveSharedFilepaths = async (projectDir, type)=>{
|
|
|
385
388
|
globalName: fallbackName,
|
|
386
389
|
type: t,
|
|
387
390
|
modules: s.usedExports,
|
|
388
|
-
canTreeShaking: s.canTreeShaking ??
|
|
391
|
+
canTreeShaking: s.canTreeShaking ?? s.usedExports?.length !== 0
|
|
389
392
|
});
|
|
390
393
|
}
|
|
391
394
|
});
|
|
@@ -841,18 +844,17 @@ async function serveLocalFile(c, rootDir) {
|
|
|
841
844
|
}
|
|
842
845
|
function createStaticRoute(opts) {
|
|
843
846
|
const staticRoute = new external_hono_namespaceObject.Hono();
|
|
844
|
-
const rootDir =
|
|
847
|
+
const rootDir = opts?.rootDir ?? DEFAULT_STATIC_ROOT;
|
|
845
848
|
staticRoute.get('/tree-shaking-shared/*', async (c)=>serveLocalFile(c, rootDir));
|
|
846
849
|
return staticRoute;
|
|
847
850
|
}
|
|
848
851
|
const timeout_namespaceObject = require("hono/timeout");
|
|
849
852
|
function createApp(deps, opts) {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
setRuntimeEnv((null == opts ? void 0 : opts.runtimeEnv) ?? process.env);
|
|
853
|
+
if (opts?.logger) setLogger(opts.logger);
|
|
854
|
+
setRuntimeEnv(opts?.runtimeEnv ?? process.env);
|
|
853
855
|
const app = new external_hono_namespaceObject.Hono();
|
|
854
|
-
const corsOrigin =
|
|
855
|
-
const staticRootDir =
|
|
856
|
+
const corsOrigin = opts?.corsOrigin ?? '*';
|
|
857
|
+
const staticRootDir = opts?.staticRootDir ?? DEFAULT_STATIC_ROOT;
|
|
856
858
|
app.use('*', (0, cors_namespaceObject.cors)({
|
|
857
859
|
origin: corsOrigin,
|
|
858
860
|
allowMethods: [
|
|
@@ -868,7 +870,7 @@ function createApp(deps, opts) {
|
|
|
868
870
|
app.use('*', loggerMiddleware);
|
|
869
871
|
app.use('*', createDiMiddleware(deps));
|
|
870
872
|
app.use('*', (0, timeout_namespaceObject.timeout)(60000));
|
|
871
|
-
if (
|
|
873
|
+
if (opts?.appExtensions?.length) for (const extend of opts.appExtensions)extend(app);
|
|
872
874
|
app.get('/tree-shaking-shared/healthz', (c)=>c.json({
|
|
873
875
|
status: 'ok',
|
|
874
876
|
timestamp: new Date().toISOString()
|
|
@@ -877,8 +879,8 @@ function createApp(deps, opts) {
|
|
|
877
879
|
app.route('/', createStaticRoute({
|
|
878
880
|
rootDir: staticRootDir
|
|
879
881
|
}));
|
|
880
|
-
if (
|
|
881
|
-
startPeriodicPrune(
|
|
882
|
+
if (opts?.frontendAdapters?.length) for (const adapter of opts.frontendAdapters)adapter.register(app);
|
|
883
|
+
startPeriodicPrune(opts?.pruneIntervalMs);
|
|
882
884
|
return app;
|
|
883
885
|
}
|
|
884
886
|
const node_server_namespaceObject = require("@hono/node-server");
|
|
@@ -934,9 +936,9 @@ class LocalObjectStore {
|
|
|
934
936
|
constructor(opts){
|
|
935
937
|
localObjectStore_define_property(this, "rootDir", void 0);
|
|
936
938
|
localObjectStore_define_property(this, "publicBaseUrl", void 0);
|
|
937
|
-
this.rootDir =
|
|
939
|
+
this.rootDir = opts?.rootDir ?? external_node_path_default().join(process.cwd(), 'log', 'static');
|
|
938
940
|
const port = process.env.PORT || 3000;
|
|
939
|
-
const base =
|
|
941
|
+
const base = opts?.publicBaseUrl === '/' ? `http://localhost:${port}/` : opts?.publicBaseUrl ?? '/';
|
|
940
942
|
this.publicBaseUrl = base.endsWith('/') ? base : `${base}/`;
|
|
941
943
|
}
|
|
942
944
|
}
|
|
@@ -998,7 +1000,7 @@ exports.createApp = __webpack_exports__.createApp;
|
|
|
998
1000
|
exports.createLogger = __webpack_exports__.createLogger;
|
|
999
1001
|
exports.createOssAdapterRegistry = __webpack_exports__.createOssAdapterRegistry;
|
|
1000
1002
|
exports.createServer = __webpack_exports__.createServer;
|
|
1001
|
-
for(var
|
|
1003
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
1002
1004
|
"LocalAdapter",
|
|
1003
1005
|
"LocalObjectStore",
|
|
1004
1006
|
"createAdapterDeps",
|
|
@@ -1007,7 +1009,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
1007
1009
|
"createLogger",
|
|
1008
1010
|
"createOssAdapterRegistry",
|
|
1009
1011
|
"createServer"
|
|
1010
|
-
].indexOf(
|
|
1012
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
1011
1013
|
Object.defineProperty(exports, '__esModule', {
|
|
1012
1014
|
value: true
|
|
1013
1015
|
});
|