Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build by rollup #390

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
713 changes: 713 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
"default": "./dist/index.js"
},
"sideEffects": false,
"engines": {
"node": ">=18"
},
"scripts": {
"benchmark": "node benchmark.js",
"test": "xo && ava && tsd"
"test": "xo && ava && tsd",
"build": "rollup -c rollup.config.js"
},
"files": [
"index.js",
"dist/index.js",
"index.d.ts",
"base.js",
"base.d.ts"
Expand All @@ -51,10 +52,13 @@
"split-on-first": "^3.0.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-swc": "^0.3.1",
"ava": "^6.1.1",
"benchmark": "^2.1.4",
"deep-equal": "^2.2.3",
"fast-check": "^3.15.1",
"rollup": "^4.20.0",
"tsd": "^0.30.7",
"xo": "^0.57.0"
},
Expand Down
22 changes: 22 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {defineConfig} from 'rollup';
import resolve from '@rollup/plugin-node-resolve';
import swc from '@rollup/plugin-swc';

const swcConfig = {
swc: {
env: {
target: 'es5',
},
},
};
export default defineConfig({
input: 'index.js',
output: {
file: 'dist/index.js',
format: 'esm',
},
plugins: [
resolve(),
swc(swcConfig),
],
});
2 changes: 1 addition & 1 deletion test/exclude.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('excludes elements in a URL with a filter array', t => {
t.is(queryString.exclude('http://example.com/?a=1&b=2&c=3#a', ['c']), 'http://example.com/?a=1&b=2#a');
Expand Down
2 changes: 1 addition & 1 deletion test/extract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('extracts query string from url', t => {
t.is(queryString.extract('https://foo.bar/?abc=def&hij=klm'), 'abc=def&hij=klm');
Expand Down
2 changes: 1 addition & 1 deletion test/parse-url.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('handles strings with query string', t => {
t.deepEqual(queryString.parseUrl('https://foo.bar#top?foo=bar'), {url: 'https://foo.bar', query: {}});
Expand Down
2 changes: 1 addition & 1 deletion test/parse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('query strings starting with a `?`', t => {
t.deepEqual(queryString.parse('?foo=bar'), {foo: 'bar'});
Expand Down
2 changes: 1 addition & 1 deletion test/pick.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('picks elements in a URL with a filter array', t => {
t.is(queryString.pick('http://example.com/?a=1&b=2&c=3#a', ['a', 'b']), 'http://example.com/?a=1&b=2#a');
Expand Down
2 changes: 1 addition & 1 deletion test/properties.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import deepEqual from 'deep-equal';
import fastCheck from 'fast-check';
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

// Valid query parameters must follow:
// - key can be any unicode string (not empty)
Expand Down
2 changes: 1 addition & 1 deletion test/stringify-url.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('stringify URL without a query string', t => {
t.is(queryString.stringifyUrl({url: 'https://foo.bar/'}), 'https://foo.bar/');
Expand Down
2 changes: 1 addition & 1 deletion test/stringify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import queryString from '../index.js';
import queryString from '../dist/index.js';

test('stringify', t => {
t.is(queryString.stringify({foo: 'bar'}), 'foo=bar');
Expand Down