Skip to content

Commit 44a25cf

Browse files
committed
feat: make all ESM module locked as dynamic import
1 parent 51eda91 commit 44a25cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1238
-658
lines changed

biome.json

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
33
"assist": { "actions": { "source": { "organizeImports": "on" } } },
44
"vcs": {
55
"enabled": true,
@@ -9,7 +9,13 @@
99
},
1010
"files": {
1111
"ignoreUnknown": true,
12-
"includes": ["**", "!**/*.vue", "!**/dist", "!**/dist-types"]
12+
"includes": [
13+
"**",
14+
"!**/*.vue",
15+
"!**/dist/",
16+
"!**/dist-types/",
17+
"!tests/mock/tests/mockHoist.test.ts"
18+
]
1319
},
1420
"formatter": {
1521
"indentStyle": "space"
@@ -64,5 +70,17 @@
6470
"useHookAtTopLevel": "off"
6571
}
6672
}
67-
}
73+
},
74+
"overrides": [
75+
{
76+
"includes": ["e2e/__mocks__/**/*"],
77+
"linter": {
78+
"rules": {
79+
"style": {
80+
"useFilenamingConvention": "off"
81+
}
82+
}
83+
}
84+
}
85+
]
6886
}

e2e/__mocks__/is-url.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { rs } = require('@rstest/core');
2+
3+
module.exports = () => 'is-url mock';
4+
module.exports.fn = rs.fn();

e2e/__mocks__/redux-cjs.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
isAction: rs.fn(),
3+
mocked: 'redux_yes',
4+
};

e2e/basic/test/index.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ describe('Index', () => {
2424
});
2525

2626
it('should use require.resolve correctly', async () => {
27-
expect(
28-
require.resolve('../src/index.ts').endsWith('index.ts'),
29-
).toBeTruthy();
27+
const resolved = require.resolve('../src/index.ts');
28+
expect(resolved.endsWith('index.ts')).toBeTruthy();
3029
});
3130
});

e2e/dom/fixtures/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"react-dom": "^19.1.1"
1313
},
1414
"devDependencies": {
15-
"@rsbuild/core": "1.5.0",
15+
"@rsbuild/core": "1.5.6",
1616
"@rsbuild/plugin-react": "^1.3.5",
1717
"@testing-library/jest-dom": "^6.8.0",
1818
"@testing-library/dom": "^10.4.1",

e2e/lifecycle/timeout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('test timeout', () => {
3434
),
3535
).toBeTruthy();
3636
expect(
37-
logs.find((log) => log.includes('timeout.test.ts:4:10')),
37+
logs.find((log) => log.includes('timeout.test.ts:4:1')),
3838
).toBeTruthy();
3939
expect(
4040
logs.find((log) => log.includes('Test Files 1 failed')),

e2e/mock/fixtures/unmock/rstest.setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rs } from '@rstest/core';
1+
// import { rs } from '@rstest/core';
22

33
process.env.NODE_ENV = 'rstest:production';
44

e2e/mock/src/bar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const bar = 'bar';

e2e/mock/src/foo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const foo = 'foo';

e2e/mock/src/readSomeFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { readFileSync } from 'node:fs';
1+
import * as fs from 'node:fs';
22

33
export function readSomeFile(path: string) {
4-
return readFileSync(path, 'utf-8');
4+
return fs?.readFileSync?.(path, 'utf-8');
55
}

0 commit comments

Comments
 (0)