Skip to content

Commit be32255

Browse files
v0.5.1
1 parent 69f663c commit be32255

File tree

6 files changed

+37
-15
lines changed

6 files changed

+37
-15
lines changed

cjs/your-function.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const showDiff = (filename, source, code, diffOption, pluginName) => {
129129
/**
130130
* [rollup-plugin-your-function]{@link https://github.com/UmamiAppearance/rollup-plugin-your-function}
131131
*
132-
* @version 0.5.0
132+
* @version 0.5.1
133133
* @author UmamiAppearance [[email protected]]
134134
* @license MIT
135135
*/

cjs/your-function.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rollup-plugin-your-function",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "Provide a custom function as a rollup plugin.",
55
"main": "./cjs/your-function.cjs",
66
"module": "./src/your-function.js",
@@ -49,6 +49,6 @@
4949
"devDependencies": {
5050
"ava": "^5.2.0",
5151
"eslint": "^8.36.0",
52-
"rollup": "^3.19.1"
52+
"rollup": "^3.20.0"
5353
}
5454
}

src/your-function.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* [rollup-plugin-your-function]{@link https://github.com/UmamiAppearance/rollup-plugin-your-function}
33
*
4-
* @version 0.5.0
4+
* @version 0.5.1
55
* @author UmamiAppearance [[email protected]]
66
* @license MIT
77
*/

test/main.test.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test("manually replace a string for a build file (async)", async (t) => {
3232
plugins: [
3333
yourFunction({
3434
fn: async source => {
35-
await sleep(100);
35+
await sleep(50);
3636
return source.replace("hello world!", replacement);
3737
}
3838
})
@@ -45,6 +45,28 @@ test("manually replace a string for a build file (async)", async (t) => {
4545
});
4646

4747

48+
test("generate a source map", async (t) => {
49+
50+
const bundle = await rollup({
51+
input: "./test/fixtures/hello.js",
52+
plugins: [
53+
yourFunction({
54+
fn: source => {
55+
return { code: source.replaceAll("helloWorld", "hello") };
56+
}
57+
})
58+
]
59+
});
60+
61+
const { output } = await bundle.generate({ format: "cjs", sourcemap: true });
62+
63+
t.truthy(output[0].map);
64+
t.is(output[0].map.version, 3);
65+
t.is(output[0].map.file, "hello.js");
66+
t.is(output[0].map.mappings, ";;AAAK,MAAC,KAAU,GAAG,MAAM;AACzB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAChC;;;;");
67+
});
68+
69+
4870
test("create an output plugin", async (t) => {
4971

5072
const replacement = "saluton mondo!";

0 commit comments

Comments
 (0)