File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33[ ![ Unit Test] ( https://github.com/unplugin/unplugin-raw/actions/workflows/unit-test.yml/badge.svg )] ( https://github.com/unplugin/unplugin-raw/actions/workflows/unit-test.yml )
44
5- Transform file to a default-export string. It will be transformed to JavaScript, then a string .
5+ Transform file to a default-export string, and can be transformed by esbuild .
66
77## Installation
88
99``` bash
1010npm i -D unplugin-raw
11+
12+ npm i -D esbuild # Optional, if you want to transform TypeScript to JavaScript
1113```
1214
1315<details >
@@ -38,6 +40,20 @@ export default {
3840
3941<br ></details >
4042
43+ <details >
44+ <summary >Rolldown</summary ><br >
45+
46+ ``` ts
47+ // rolldown.config.js
48+ import Raw from ' unplugin-raw/rolldown'
49+
50+ export default {
51+ plugins: [Raw ()],
52+ }
53+ ```
54+
55+ <br ></details >
56+
4157<details >
4258<summary >esbuild</summary ><br >
4359
@@ -52,18 +68,28 @@ build({
5268
5369<br ></details >
5470
55- <!-- <details>
56- <summary>Webpack</summary><br>
71+ ## Options
5772
5873``` ts
59- // webpack.config.js
60- module.exports = {
61- /* ... */
62- plugins: [require('unplugin-raw/webpack')()],
74+ export interface TransformOptions {
75+ /** @default [/\.[cm]?[jt]sx?$/] */
76+ include? : FilterPattern
77+ /** @default [/node_modules/] */
78+ exclude? : FilterPattern
79+ /** @default {} */
80+ options? : EsbuildTransformOptions
6381}
64- ```
6582
66- <br></details> -->
83+ export interface Options {
84+ /** @default ' pre' */
85+ enforce? : ' pre' | ' post' | undefined
86+ /**
87+ * Transform
88+ * @default false
89+ */
90+ transform? : TransformOptions | boolean
91+ }
92+ ```
6793
6894## Usage
6995
Original file line number Diff line number Diff line change 5959 "release" : " bumpp && pnpm publish" ,
6060 "prepublishOnly" : " pnpm run build"
6161 },
62+ "peerDependencies" : {
63+ "esbuild" : " >=0.25.0"
64+ },
65+ "peerDependenciesMeta" : {
66+ "esbuild" : {
67+ "optional" : true
68+ }
69+ },
6270 "dependencies" : {
63- "esbuild" : " ^0.25.8" ,
6471 "unplugin" : " ^2.3.5" ,
6572 "unplugin-utils" : " ^0.2.4"
6673 },
6976 "@sxzz/prettier-config" : " ^2.2.3" ,
7077 "@types/node" : " ^24.1.0" ,
7178 "bumpp" : " ^10.2.2" ,
79+ "esbuild" : " ^0.25.9" ,
7280 "eslint" : " ^9.32.0" ,
7381 "prettier" : " ^3.6.2" ,
7482 "rollup" : " ^4.46.2" ,
You can’t perform that action at this time.
0 commit comments