rolldown-string 0.0.0 → 0.1.0

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.
Files changed (2) hide show
  1. package/README.md +22 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,12 @@
4
4
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
5
  [![Unit Test][unit-test-src]][unit-test-href]
6
6
 
7
- undefined
7
+ A compatibility layer for [magic-string](https://github.com/Rich-Harris/magic-string) to work with Rolldown and other bundlers.
8
+
9
+ - In Rolldown, [native `magic-string`](https://rolldown.rs/in-depth/native-magic-string) is used to optimize performance.
10
+ - If native support is unavailable, it gracefully falls back to the JavaScript implementation of `magic-string`.
11
+
12
+ Recommended for use with [unplugin](https://github.com/unjs/unplugin).
8
13
 
9
14
  ## Install
10
15
 
@@ -12,6 +17,22 @@ undefined
12
17
  npm i rolldown-string
13
18
  ```
14
19
 
20
+ ## Usage
21
+
22
+ ```ts
23
+ import { generateTransform, rolldownString } from 'rolldown-string'
24
+
25
+ const yourPlugin = {
26
+ transform(code, id, meta) {
27
+ const s = rolldownString(code, id, meta)
28
+
29
+ // ... your transformations
30
+
31
+ return generateTransform(s, id)
32
+ },
33
+ }
34
+ ```
35
+
15
36
  ## Sponsors
16
37
 
17
38
  <p align="center">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rolldown-string",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.1.0",
5
5
  "description": "undefined",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",