diff --git a/rollup.config.js b/rollup.config.js index 740070c..7bb98b1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -57,7 +57,7 @@ const babelExternal = [/@babel\/runtime/]; export default [ { - input: "src/JsonURL.js", + input: "src/index.js", output: [ { name: pkg.moduleName, @@ -68,7 +68,7 @@ export default [ plugins: [resolve(), commonjs(), babel(babelBundle)], }, { - input: "src/JsonURL.js", + input: "src/index.js", output: [ { name: pkg.moduleName, @@ -80,7 +80,7 @@ export default [ plugins: [resolve(), commonjs(), babel(babelBundle), terser()], }, { - input: "src/JsonURL.js", + input: "src/index.js", output: [ { name: pkg.moduleName, diff --git a/src/JsonURL.js b/src/JsonURL.js index ffe9da8..af38129 100644 --- a/src/JsonURL.js +++ b/src/JsonURL.js @@ -1792,5 +1792,3 @@ export class JsonURL { return value.toJsonURLText(options, 0); } } - -export { JsonURL as default }; diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..f9e961c --- /dev/null +++ b/src/index.js @@ -0,0 +1,30 @@ +/* + MIT License + + Copyright (c) 2020 David MacCormack + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ +import { JsonURL } from "./JsonURL.js"; + +// +// this shim simply exports a default. This makes rollup output a function +// rather than an object. +// +export default JsonURL; diff --git a/test/errors.test.js b/test/errors.test.js index 4128ebb..44231c0 100644 --- a/test/errors.test.js +++ b/test/errors.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; import { JsonURLParseOptions } from "../src/JsonURLParseOptions.js"; test.each([ diff --git a/test/parse.test.js b/test/parse.test.js index 2ab510b..f6c07e6 100644 --- a/test/parse.test.js +++ b/test/parse.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; const u = new JsonURL(); diff --git a/test/parseImplied.test.js b/test/parseImplied.test.js index 88f2fbf..e0b3913 100644 --- a/test/parseImplied.test.js +++ b/test/parseImplied.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; const u = new JsonURL(); diff --git a/test/parseImpliedStringLiterals.test.js b/test/parseImpliedStringLiterals.test.js index 2fee6da..537fe85 100644 --- a/test/parseImpliedStringLiterals.test.js +++ b/test/parseImpliedStringLiterals.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; const u = new JsonURL(); diff --git a/test/parseLiteral.test.js b/test/parseLiteral.test.js index 8482d53..ea9d073 100644 --- a/test/parseLiteral.test.js +++ b/test/parseLiteral.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; function encodedString(s) { return s diff --git a/test/parseNoComposite.test.js b/test/parseNoComposite.test.js index e077bdf..3d03d2c 100644 --- a/test/parseNoComposite.test.js +++ b/test/parseNoComposite.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; const u = new JsonURL(); diff --git a/test/parseWwwFormUrlEncoded.test.js b/test/parseWwwFormUrlEncoded.test.js index c83d5c2..8bc5694 100644 --- a/test/parseWwwFormUrlEncoded.test.js +++ b/test/parseWwwFormUrlEncoded.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; function resetOptions(options, implied = true) { if (options.impliedArray) { diff --git a/test/stringify.test.js b/test/stringify.test.js index 7b6aaa1..430bb96 100644 --- a/test/stringify.test.js +++ b/test/stringify.test.js @@ -22,7 +22,7 @@ SOFTWARE. */ -import JsonURL from "../src/JsonURL.js"; +import { JsonURL } from "../src/JsonURL.js"; // // JsonURL.stringify tests