-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
e2e/cases/plugin-api/plugin-transform-import-attributes/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { build, rspackOnlyTest } from '@e2e/helper'; | ||
import { expect } from '@playwright/test'; | ||
|
||
rspackOnlyTest( | ||
'should allow plugin to transform code with import attributes', | ||
async () => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
}); | ||
|
||
const indexJs = await rsbuild.getIndexFile(); | ||
expect(indexJs.content).toContain('with import attributes'); | ||
}, | ||
); |
10 changes: 10 additions & 0 deletions
10
e2e/cases/plugin-api/plugin-transform-import-attributes/myPlugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { RsbuildPlugin } from '@rsbuild/core'; | ||
|
||
export const myPlugin: RsbuildPlugin = { | ||
name: 'my-plugin', | ||
setup(api) { | ||
api.transform({ with: { type: 'json' } }, () => { | ||
return JSON.stringify({ type: 'with import attributes' }); | ||
}); | ||
}, | ||
}; |
6 changes: 6 additions & 0 deletions
6
e2e/cases/plugin-api/plugin-transform-import-attributes/rsbuild.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
import { myPlugin } from './myPlugin'; | ||
|
||
export default defineConfig({ | ||
plugins: [myPlugin], | ||
}); |
3 changes: 3 additions & 0 deletions
3
e2e/cases/plugin-api/plugin-transform-import-attributes/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import one from './pkg-1.json' with { type: 'json' }; | ||
|
||
console.log('one', one); |
3 changes: 3 additions & 0 deletions
3
e2e/cases/plugin-api/plugin-transform-import-attributes/src/pkg-1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
718c89d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open