Skip to content

Commit 888a5d9

Browse files
committed
fix: make rollup produce a function rather than object
1 parent 191e425 commit 888a5d9

11 files changed

+41
-13
lines changed

rollup.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const babelExternal = [/@babel\/runtime/];
5757

5858
export default [
5959
{
60-
input: "src/JsonURL.js",
60+
input: "src/index.js",
6161
output: [
6262
{
6363
name: pkg.moduleName,
@@ -68,7 +68,7 @@ export default [
6868
plugins: [resolve(), commonjs(), babel(babelBundle)],
6969
},
7070
{
71-
input: "src/JsonURL.js",
71+
input: "src/index.js",
7272
output: [
7373
{
7474
name: pkg.moduleName,
@@ -80,7 +80,7 @@ export default [
8080
plugins: [resolve(), commonjs(), babel(babelBundle), terser()],
8181
},
8282
{
83-
input: "src/JsonURL.js",
83+
input: "src/index.js",
8484
output: [
8585
{
8686
name: pkg.moduleName,

src/JsonURL.js

-2
Original file line numberDiff line numberDiff line change
@@ -1792,5 +1792,3 @@ export class JsonURL {
17921792
return value.toJsonURLText(options, 0);
17931793
}
17941794
}
1795-
1796-
export { JsonURL as default };

src/index.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
MIT License
3+
4+
Copyright (c) 2020 David MacCormack
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
import { JsonURL } from "./JsonURL.js";
25+
26+
//
27+
// this shim simply exports a default. This makes rollup output a function
28+
// rather than an object.
29+
//
30+
export default JsonURL;

test/errors.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626
import { JsonURLParseOptions } from "../src/JsonURLParseOptions.js";
2727

2828
test.each([

test/parse.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
const u = new JsonURL();
2828

test/parseImplied.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
const u = new JsonURL();
2828

test/parseImpliedStringLiterals.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
const u = new JsonURL();
2828

test/parseLiteral.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
function encodedString(s) {
2828
return s

test/parseNoComposite.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
const u = new JsonURL();
2828

test/parseWwwFormUrlEncoded.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
function resetOptions(options, implied = true) {
2828
if (options.impliedArray) {

test/stringify.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
*/
2424

25-
import JsonURL from "../src/JsonURL.js";
25+
import { JsonURL } from "../src/JsonURL.js";
2626

2727
//
2828
// JsonURL.stringify tests

0 commit comments

Comments
 (0)