@module-federation/treeshake-server 0.0.1-alpha.0 → 0.0.1-alpha.1
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/adapters/local/localObjectStore.d.ts +0 -1
- package/dist/adapters/types.d.ts +0 -4
- package/dist/index.js +2 -25
- package/dist/index.mjs +2 -25
- package/dist/server.js +2 -25
- package/dist/server.mjs +2 -25
- package/package.json +1 -1
|
@@ -8,6 +8,5 @@ export declare class LocalObjectStore implements ObjectStore {
|
|
|
8
8
|
});
|
|
9
9
|
exists(key: string): Promise<boolean>;
|
|
10
10
|
uploadFile(localPath: string, key: string): Promise<void>;
|
|
11
|
-
downloadFile(key: string, localPath: string): Promise<void>;
|
|
12
11
|
publicUrl(key: string): string;
|
|
13
12
|
}
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -19,10 +19,6 @@ export interface ObjectStore {
|
|
|
19
19
|
* Upload a local file to the object store under the given key.
|
|
20
20
|
*/
|
|
21
21
|
uploadFile(localPath: string, key: string): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Download a file from the object store to a local path.
|
|
24
|
-
*/
|
|
25
|
-
downloadFile(key: string, localPath: string): Promise<void>;
|
|
26
22
|
/**
|
|
27
23
|
* Convert a key to a publicly reachable URL.
|
|
28
24
|
*/
|
package/dist/index.js
CHANGED
|
@@ -576,12 +576,7 @@ async function uploadProject(uploadResults, sharedFilePaths, normalizedConfig, p
|
|
|
576
576
|
}
|
|
577
577
|
logger_logger.info(`Downloading ${item.name}@${item.version} -> ${localPath}`);
|
|
578
578
|
const t0 = Date.now();
|
|
579
|
-
|
|
580
|
-
config,
|
|
581
|
-
sharedKey,
|
|
582
|
-
type: item.type
|
|
583
|
-
});
|
|
584
|
-
await store.downloadFile(cdnPath, localPath);
|
|
579
|
+
await downloadToFile(item.cdnUrl, localPath);
|
|
585
580
|
const tDownload = Date.now() - t0;
|
|
586
581
|
logger_logger.info(`Downloaded ${item.name}@${item.version} in ${tDownload}ms`);
|
|
587
582
|
const newCdnUrl = await publisher.publishFile({
|
|
@@ -642,17 +637,7 @@ async function upload(sharedFilePaths, uploadResults, normalizedConfig, uploadOp
|
|
|
642
637
|
const jsonPath = external_node_path_default().join(tmpDir, `${item.name}-${item.version}.json`);
|
|
643
638
|
try {
|
|
644
639
|
const tJson0 = Date.now();
|
|
645
|
-
|
|
646
|
-
const config = normalizedConfig[sharedKey];
|
|
647
|
-
if (config) {
|
|
648
|
-
const cdnPath = retrieveCDNPath({
|
|
649
|
-
config,
|
|
650
|
-
sharedKey,
|
|
651
|
-
type: item.type
|
|
652
|
-
});
|
|
653
|
-
const jsonCdnPath = cdnPath.replace(/\.js$/, '.json');
|
|
654
|
-
await store.downloadFile(jsonCdnPath, jsonPath);
|
|
655
|
-
} else await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
640
|
+
await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
656
641
|
const tJson = Date.now() - tJson0;
|
|
657
642
|
logger_logger.info(`Downloaded ${item.name}@${item.version} json in ${tJson}ms`);
|
|
658
643
|
const jsonContent = JSON.parse(await promises_default().readFile(jsonPath, 'utf8'));
|
|
@@ -936,14 +921,6 @@ class LocalObjectStore {
|
|
|
936
921
|
});
|
|
937
922
|
await external_node_fs_default().promises.copyFile(localPath, dest);
|
|
938
923
|
}
|
|
939
|
-
async downloadFile(key, localPath) {
|
|
940
|
-
const rel = key.replace(/^\//, '');
|
|
941
|
-
const src = external_node_path_default().join(this.rootDir, rel);
|
|
942
|
-
await external_node_fs_default().promises.mkdir(external_node_path_default().dirname(localPath), {
|
|
943
|
-
recursive: true
|
|
944
|
-
});
|
|
945
|
-
await external_node_fs_default().promises.copyFile(src, localPath);
|
|
946
|
-
}
|
|
947
924
|
publicUrl(key) {
|
|
948
925
|
return `${this.publicBaseUrl}${key.replace(/^\//, '')}`;
|
|
949
926
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -528,12 +528,7 @@ async function uploadProject(uploadResults, sharedFilePaths, normalizedConfig, p
|
|
|
528
528
|
}
|
|
529
529
|
logger_logger.info(`Downloading ${item.name}@${item.version} -> ${localPath}`);
|
|
530
530
|
const t0 = Date.now();
|
|
531
|
-
|
|
532
|
-
config,
|
|
533
|
-
sharedKey,
|
|
534
|
-
type: item.type
|
|
535
|
-
});
|
|
536
|
-
await store.downloadFile(cdnPath, localPath);
|
|
531
|
+
await downloadToFile(item.cdnUrl, localPath);
|
|
537
532
|
const tDownload = Date.now() - t0;
|
|
538
533
|
logger_logger.info(`Downloaded ${item.name}@${item.version} in ${tDownload}ms`);
|
|
539
534
|
const newCdnUrl = await publisher.publishFile({
|
|
@@ -594,17 +589,7 @@ async function upload(sharedFilePaths, uploadResults, normalizedConfig, uploadOp
|
|
|
594
589
|
const jsonPath = node_path.join(tmpDir, `${item.name}-${item.version}.json`);
|
|
595
590
|
try {
|
|
596
591
|
const tJson0 = Date.now();
|
|
597
|
-
|
|
598
|
-
const config = normalizedConfig[sharedKey];
|
|
599
|
-
if (config) {
|
|
600
|
-
const cdnPath = retrieveCDNPath({
|
|
601
|
-
config,
|
|
602
|
-
sharedKey,
|
|
603
|
-
type: item.type
|
|
604
|
-
});
|
|
605
|
-
const jsonCdnPath = cdnPath.replace(/\.js$/, '.json');
|
|
606
|
-
await store.downloadFile(jsonCdnPath, jsonPath);
|
|
607
|
-
} else await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
592
|
+
await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
608
593
|
const tJson = Date.now() - tJson0;
|
|
609
594
|
logger_logger.info(`Downloaded ${item.name}@${item.version} json in ${tJson}ms`);
|
|
610
595
|
const jsonContent = JSON.parse(await promises.readFile(jsonPath, 'utf8'));
|
|
@@ -885,14 +870,6 @@ class LocalObjectStore {
|
|
|
885
870
|
});
|
|
886
871
|
await node_fs.promises.copyFile(localPath, dest);
|
|
887
872
|
}
|
|
888
|
-
async downloadFile(key, localPath) {
|
|
889
|
-
const rel = key.replace(/^\//, '');
|
|
890
|
-
const src = node_path.join(this.rootDir, rel);
|
|
891
|
-
await node_fs.promises.mkdir(node_path.dirname(localPath), {
|
|
892
|
-
recursive: true
|
|
893
|
-
});
|
|
894
|
-
await node_fs.promises.copyFile(src, localPath);
|
|
895
|
-
}
|
|
896
873
|
publicUrl(key) {
|
|
897
874
|
return `${this.publicBaseUrl}${key.replace(/^\//, '')}`;
|
|
898
875
|
}
|
package/dist/server.js
CHANGED
|
@@ -80,14 +80,6 @@ class LocalObjectStore {
|
|
|
80
80
|
});
|
|
81
81
|
await external_node_fs_default().promises.copyFile(localPath, dest);
|
|
82
82
|
}
|
|
83
|
-
async downloadFile(key, localPath) {
|
|
84
|
-
const rel = key.replace(/^\//, '');
|
|
85
|
-
const src = external_node_path_default().join(this.rootDir, rel);
|
|
86
|
-
await external_node_fs_default().promises.mkdir(external_node_path_default().dirname(localPath), {
|
|
87
|
-
recursive: true
|
|
88
|
-
});
|
|
89
|
-
await external_node_fs_default().promises.copyFile(src, localPath);
|
|
90
|
-
}
|
|
91
83
|
publicUrl(key) {
|
|
92
84
|
return `${this.publicBaseUrl}${key.replace(/^\//, '')}`;
|
|
93
85
|
}
|
|
@@ -726,12 +718,7 @@ async function uploadProject(uploadResults, sharedFilePaths, normalizedConfig, p
|
|
|
726
718
|
}
|
|
727
719
|
logger_logger.info(`Downloading ${item.name}@${item.version} -> ${localPath}`);
|
|
728
720
|
const t0 = Date.now();
|
|
729
|
-
|
|
730
|
-
config,
|
|
731
|
-
sharedKey,
|
|
732
|
-
type: item.type
|
|
733
|
-
});
|
|
734
|
-
await store.downloadFile(cdnPath, localPath);
|
|
721
|
+
await downloadToFile(item.cdnUrl, localPath);
|
|
735
722
|
const tDownload = Date.now() - t0;
|
|
736
723
|
logger_logger.info(`Downloaded ${item.name}@${item.version} in ${tDownload}ms`);
|
|
737
724
|
const newCdnUrl = await publisher.publishFile({
|
|
@@ -792,17 +779,7 @@ async function upload(sharedFilePaths, uploadResults, normalizedConfig, uploadOp
|
|
|
792
779
|
const jsonPath = external_node_path_default().join(tmpDir, `${item.name}-${item.version}.json`);
|
|
793
780
|
try {
|
|
794
781
|
const tJson0 = Date.now();
|
|
795
|
-
|
|
796
|
-
const config = normalizedConfig[sharedKey];
|
|
797
|
-
if (config) {
|
|
798
|
-
const cdnPath = retrieveCDNPath({
|
|
799
|
-
config,
|
|
800
|
-
sharedKey,
|
|
801
|
-
type: item.type
|
|
802
|
-
});
|
|
803
|
-
const jsonCdnPath = cdnPath.replace(/\.js$/, '.json');
|
|
804
|
-
await store.downloadFile(jsonCdnPath, jsonPath);
|
|
805
|
-
} else await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
782
|
+
await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
806
783
|
const tJson = Date.now() - tJson0;
|
|
807
784
|
logger_logger.info(`Downloaded ${item.name}@${item.version} json in ${tJson}ms`);
|
|
808
785
|
const jsonContent = JSON.parse(await promises_default().readFile(jsonPath, 'utf8'));
|
package/dist/server.mjs
CHANGED
|
@@ -66,14 +66,6 @@ class LocalObjectStore {
|
|
|
66
66
|
});
|
|
67
67
|
await node_fs.promises.copyFile(localPath, dest);
|
|
68
68
|
}
|
|
69
|
-
async downloadFile(key, localPath) {
|
|
70
|
-
const rel = key.replace(/^\//, '');
|
|
71
|
-
const src = node_path.join(this.rootDir, rel);
|
|
72
|
-
await node_fs.promises.mkdir(node_path.dirname(localPath), {
|
|
73
|
-
recursive: true
|
|
74
|
-
});
|
|
75
|
-
await node_fs.promises.copyFile(src, localPath);
|
|
76
|
-
}
|
|
77
69
|
publicUrl(key) {
|
|
78
70
|
return `${this.publicBaseUrl}${key.replace(/^\//, '')}`;
|
|
79
71
|
}
|
|
@@ -697,12 +689,7 @@ async function uploadProject(uploadResults, sharedFilePaths, normalizedConfig, p
|
|
|
697
689
|
}
|
|
698
690
|
logger_logger.info(`Downloading ${item.name}@${item.version} -> ${localPath}`);
|
|
699
691
|
const t0 = Date.now();
|
|
700
|
-
|
|
701
|
-
config,
|
|
702
|
-
sharedKey,
|
|
703
|
-
type: item.type
|
|
704
|
-
});
|
|
705
|
-
await store.downloadFile(cdnPath, localPath);
|
|
692
|
+
await downloadToFile(item.cdnUrl, localPath);
|
|
706
693
|
const tDownload = Date.now() - t0;
|
|
707
694
|
logger_logger.info(`Downloaded ${item.name}@${item.version} in ${tDownload}ms`);
|
|
708
695
|
const newCdnUrl = await publisher.publishFile({
|
|
@@ -763,17 +750,7 @@ async function upload(sharedFilePaths, uploadResults, normalizedConfig, uploadOp
|
|
|
763
750
|
const jsonPath = node_path.join(tmpDir, `${item.name}-${item.version}.json`);
|
|
764
751
|
try {
|
|
765
752
|
const tJson0 = Date.now();
|
|
766
|
-
|
|
767
|
-
const config = normalizedConfig[sharedKey];
|
|
768
|
-
if (config) {
|
|
769
|
-
const cdnPath = retrieveCDNPath({
|
|
770
|
-
config,
|
|
771
|
-
sharedKey,
|
|
772
|
-
type: item.type
|
|
773
|
-
});
|
|
774
|
-
const jsonCdnPath = cdnPath.replace(/\.js$/, '.json');
|
|
775
|
-
await store.downloadFile(jsonCdnPath, jsonPath);
|
|
776
|
-
} else await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
753
|
+
await downloadToFile(item.cdnUrl.replace('.js', '.json'), jsonPath);
|
|
777
754
|
const tJson = Date.now() - tJson0;
|
|
778
755
|
logger_logger.info(`Downloaded ${item.name}@${item.version} json in ${tJson}ms`);
|
|
779
756
|
const jsonContent = JSON.parse(await promises.readFile(jsonPath, 'utf8'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/treeshake-server",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
4
|
"description": "Build service powered by Hono that installs dependencies, builds with Rspack, and uploads artifacts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|