Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-metro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-modern-ssr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-modern.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-next-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-next-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Install Pnpm
run: |
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup Pnpm
run: |
npm install -g corepack@latest --force
corepack prepare pnpm@8.11.0 --activate
corepack prepare pnpm@10.18.1 --activate
corepack enable

- name: Setup Node.js
Expand Down
2 changes: 1 addition & 1 deletion apps/website-new/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "rspress dev",
"build": "rspress build",
"build": "pnpm exec nx run rsbuild-plugin:build && rspress build",
"preview": "rspress preview"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.0.0",
"engines": {
"node": "^18",
"pnpm": "^8.11.0"
"pnpm": "^10.18.1"
},
"packageManager": "pnpm@8.11.0",
"packageManager": "pnpm@10.18.1",
"private": true,
"description": "Module Federation v2",
"main": "src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/chrome-devtools/src/component/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ const FormComponent = (props: FormProps & RootComponentProps) => {
<Select
data-set-e2e={'e2eProxyKey'}
placeholder={'Module Name'}
onChange={(key) => onKeyChange(key, index)}
onChange={(key: string) => onKeyChange(key, index)}
allowClear
showSearch
>
Expand Down
2 changes: 1 addition & 1 deletion packages/chrome-devtools/src/component/Graph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const Graph = (props: { snapshot: GlobalModuleInfo }) => {

const onConnect = useCallback(
(params: Edge | Connection) =>
setEdges((eds) =>
setEdges((eds: Edge[]) =>
addEdge(
{ ...params, type: ConnectionLineType.SmoothStep, animated: true },
eds,
Expand Down
1 change: 1 addition & 0 deletions packages/dts-plugin/src/core/configurations/hostPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const resolveRemotes = (hostOptions: Required<HostOptions>) => {
if (accumulator[key]) {
accumulator[key] = {
...accumulator[key],
name: res.name || accumulator[key].name,
url: res.url,
apiTypeUrl: accumulator[key].apiTypeUrl || res.apiTypeUrl,
};
Expand Down
52 changes: 42 additions & 10 deletions packages/dts-plugin/src/core/lib/DTSManager.advance.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AdmZip from 'adm-zip';
import axios from 'axios';
import dirTree from 'directory-tree';
import { readFileSync, rmSync } from 'fs';
import { readFileSync, rmSync, existsSync } from 'fs';
import { join } from 'path';
import { describe, expect, it, vi, beforeAll } from 'vitest';
import { DTSManager } from './DTSManager';
Expand Down Expand Up @@ -48,22 +48,38 @@ describe('DTSManager advance usage', () => {
},
typesFolder: `${TEST_DIT_DIR}/@mf-types-dts-test-consume-types-advance`,
consumeAPITypes: true,
remoteTypeUrls: {
remotes: {
zip: 'https://bar.it/@mf-types.zip',
api: 'https://bar.it/@mf-types.d.ts',
alias: 'remotes',
},
},
};

const dtsManager = new DTSManager({
remote: remoteOptions,
host: hostOptions,
});

beforeAll(() => {
beforeAll(async () => {
try {
rmSync(join(projectRoot, 'node_modules/.cache/mf-types'), {
recursive: true,
});
} catch (err) {
//noop
}
});

// Generate types once for all tests to use
try {
await dtsManager.generateTypes();
console.log('generateTypes done in beforeAll');
} catch (err) {
console.log('generateTypes failed in beforeAll');
console.error(err);
}
}, 30000); // Increased timeout to 30 seconds

it('generate types with api declaration file', async () => {
const distFolder = join(
Expand All @@ -88,8 +104,12 @@ describe('DTSManager advance usage', () => {

it('correct consumeTypes', async () => {
const distFolder = join(projectRoot, TEST_DIT_DIR, typesFolder);

// The types should already be generated in beforeAll
expect(existsSync(distFolder)).toBeTruthy();

const zip = new AdmZip();
await zip.addLocalFolderPromise(distFolder, {});
zip.addLocalFolder(distFolder);

const apiDistFolder = join(
projectRoot,
Expand All @@ -98,14 +118,26 @@ describe('DTSManager advance usage', () => {
);
const apiFile = `${apiDistFolder}.d.ts`;
// const prevAxiosGet = axios.get;
axios.get = (url) => {
axios.get = vi.fn().mockImplementation((url, options) => {
if (url.includes('.d.ts')) {
return vi
.fn()
.mockResolvedValueOnce({ data: readFileSync(apiFile, 'utf8') })();
return Promise.resolve({
data: readFileSync(apiFile, 'utf8'),
headers: {},
});
}
return vi.fn().mockResolvedValueOnce({ data: zip.toBuffer() })();
};
// Convert Buffer to ArrayBuffer when responseType is 'arraybuffer'
const buffer = zip.toBuffer();
const arrayBuffer = buffer.buffer.slice(
buffer.byteOffset,
buffer.byteOffset + buffer.byteLength,
);
return Promise.resolve({
data: options?.responseType === 'arraybuffer' ? arrayBuffer : buffer,
headers: {
'content-type': 'application/zip',
},
});
});

await dtsManager.consumeTypes();

Expand Down
Loading
Loading