├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── codesmell-issue-template.md ├── dependabot.yml └── workflows │ └── ci.yml ├── .gitignore ├── .prettierrc.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── babel.config.js ├── eslint.config.js ├── itest ├── cjs │ ├── main.js │ ├── package-lock.json │ └── package.json ├── es6-babel │ ├── babel.config.js │ ├── main.js │ ├── package-lock.json │ └── package.json ├── es6-native │ ├── main.js │ ├── package-lock.json │ └── package.json ├── es6-ts │ ├── .gitignore │ ├── main.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── itest.sh └── jsdom │ ├── main.js │ ├── package-lock.json │ └── package.json ├── jest.config.js ├── jsdoc.config.js ├── jsonurl.d.ts ├── package-lock.json ├── package.json ├── rollup.config.mjs ├── script ├── cdn_build.sh ├── lint.sh └── version_snapshot.sh ├── snapshot.properties ├── sonar-project.properties ├── src ├── JsonURL.js ├── JsonURLOptions.js ├── JsonURLParseOptions.js ├── JsonURLStringifyOptions.js ├── chars.js ├── error.js ├── index.js ├── noproto.js ├── package.json └── proto.js └── test ├── errors.test.js ├── issue556.test.js ├── noproto.test.js ├── package.json ├── parse.test.js ├── parseImplied.test.js ├── parseImpliedStringLiterals.test.js ├── parseLiteral.test.js ├── parseNoComposite.test.js ├── parseWwwFormUrlEncoded.test.js └── stringify.test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | insert_final_newline = true 9 | charset = utf-8 10 | 11 | [*.{json,js,mjs,cjs}] 12 | indent_size = 2 13 | max_line_length = 80 14 | 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # default to binary 2 | #* binary 3 | 4 | # HTML, CSS, etc 5 | *.css text diff=css eol=lf 6 | *.htm text diff=html eol=lf 7 | *.html text diff=html eol=lf 8 | *.js text eol=lf 9 | *.ts text eol=lf 10 | *.mjs text eol=lf 11 | *.cjs text eol=lf 12 | *.json text eol=lf 13 | 14 | # General text 15 | *.xml text eol=lf 16 | *.md text eol=lf 17 | .gitattributes text eol=lf 18 | .gitignore text eol=lf 19 | 20 | # Binary 21 | *.gz binary 22 | 23 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @dmaccormack 2 | 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/codesmell-issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Codesmell issue template 3 | about: Identify or resolve one or more codesmells 4 | title: '' 5 | labels: codesmell 6 | assignees: dmaccormack 7 | 8 | --- 9 | 10 | Using https://sonarcloud.io/project/issues?id=jsonurl-js&resolved=false as a reference, the following codesmells have been resolved: 11 | 12 | - https://sonarcloud.io/project/issues?id=jsonurl-js&issues=... 13 | - https://sonarcloud.io/project/issues?id=jsonurl-js&issues=... 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Please see the documentation for all configuration options: 3 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 4 | # 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | assignees: 13 | - "dmaccormack" 14 | labels: 15 | - "dependency" 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | # 4 | 5 | name: ci 6 | 7 | on: 8 | push: 9 | branches-ignore: 10 | - 'dependabot/**' 11 | paths-ignore: 12 | - '**.gitattributes' 13 | - '**.gitignore' 14 | - '**.md' 15 | pull_request: 16 | paths-ignore: 17 | - '**.gitattributes' 18 | - '**.gitignore' 19 | - '**.md' 20 | 21 | jobs: 22 | artifact: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v4 26 | - name: Set artifact version 27 | run: script/version_snapshot.sh 28 | shell: bash 29 | - name: Use Node.js (latest) 30 | uses: actions/setup-node@v4 31 | with: 32 | node-version: latest 33 | - name: Cache Node.js modules 34 | timeout-minutes: 10 35 | uses: actions/cache@v4 36 | env: 37 | cache-name: cache-node-modules 38 | with: 39 | path: ~/.npm 40 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 41 | restore-keys: | 42 | ${{ runner.os }}-build-${{ env.cache-name }}- 43 | ${{ runner.os }}-build- 44 | ${{ runner.os }}- 45 | - run: npm ci 46 | - name: eslint 47 | run: ./script/lint.sh 48 | shell: bash 49 | - run: npm run build 50 | - run: npm test 51 | - name: Integration Test 52 | run: cd itest && ./itest.sh 53 | - name: Package artifacts 54 | uses: actions/upload-artifact@v4 55 | if: success() 56 | with: 57 | name: jsonurl-javascript 58 | path: dist/* 59 | 60 | matrix-build: 61 | needs: artifact 62 | if: ${{ needs.artifact.result == 'success' }} 63 | runs-on: ${{ matrix.os }} 64 | strategy: 65 | matrix: 66 | os: [macos-latest, ubuntu-latest, windows-latest] 67 | node-version: [18.x, 20.x] 68 | steps: 69 | - uses: actions/checkout@v4 70 | - name: Set up Node.js ${{ matrix.node-version }} 71 | uses: actions/setup-node@v4 72 | with: 73 | node-version: ${{ matrix.node-version }} 74 | - name: Cache Node.js modules 75 | timeout-minutes: 10 76 | uses: actions/cache@v4 77 | env: 78 | cache-name: cache-node-modules 79 | with: 80 | path: ~/.npm 81 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 82 | restore-keys: | 83 | ${{ runner.os }}-build-${{ env.cache-name }}- 84 | ${{ runner.os }}-build- 85 | ${{ runner.os }}- 86 | - run: npm ci 87 | - name: eslint 88 | run: ./script/lint.sh 89 | shell: bash 90 | - run: npm run build 91 | - run: npm test 92 | - name: Integration Test 93 | run: cd itest && ./itest.sh 94 | 95 | sonarcloud: 96 | needs: artifact 97 | if: ${{ needs.artifact.result == 'success' && github.event.repository.fork == false && ( github.event_name == 'push' || github.event.pull_request.author_association == 'OWNER' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR' ) }} 98 | runs-on: ubuntu-latest 99 | steps: 100 | - uses: actions/checkout@v4 101 | with: 102 | fetch-depth: 0 103 | - name: Set artifact version 104 | run: script/version_snapshot.sh 105 | shell: bash 106 | - name: Use Node.js (latest) 107 | uses: actions/setup-node@v4 108 | with: 109 | node-version: latest 110 | - name: Cache Node.js modules 111 | timeout-minutes: 10 112 | uses: actions/cache@v4 113 | env: 114 | cache-name: cache-node-modules 115 | with: 116 | path: ~/.npm 117 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 118 | restore-keys: | 119 | ${{ runner.os }}-build-${{ env.cache-name }}- 120 | ${{ runner.os }}-build- 121 | ${{ runner.os }}- 122 | - name: Push Info 123 | run: echo Pushed by ${{ github.event.pusher.name }} 124 | - run: npm ci 125 | - run: npx eslint -f json -o eslint.report.json 126 | - run: npm run build 127 | - run: npm test 128 | - name: SonarCloud Scan 129 | uses: sonarsource/sonarcloud-github-action@v2.0.2 130 | env: 131 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 132 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 133 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # node/npm related 3 | node_modules/ 4 | *.tgz 5 | dist/ 6 | coverage/ 7 | *.report.json 8 | 9 | # jsdoc output 10 | apidoc/ 11 | 12 | # Eclipse 13 | .project 14 | .settings/ 15 | 16 | # VSCode 17 | .vscode/ 18 | 19 | # Misc 20 | backup/ 21 | *.swp 22 | *.bak 23 | src/debug.* 24 | 25 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "options.editorconfig": true, 3 | "trailingComma": "es5" 4 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v1.1.8 2 | 3 | ## Bug Fixes 4 | 5 | * itest/es6-babel/package.json & itest/es6-babel/package-lock.json to reduce vulnerabilities ([@snyk-bot](https://github.com/snyk-bot "Link to profile for user snyk-bot")) 6 | * Fix bug stringifying number-like keys and values (#645) ([@dmaccormack](https://github.com/dmaccormack "Link to profile for user dmaccormack")) 7 | 8 | # v1.1.7 9 | 10 | ## Bug Fixes 11 | 12 | * Drop support for Node 10.x ([@dmaccormack](https://github.com/dmaccormack "Link to profile for user dmaccormack")) 13 | * Fix parse when the last value of an implied AQF object/array is falsey ([@dmaccormack](https://github.com/dmaccormack "Link to profile for user dmaccormack")) 14 | * Update multiple build dependencies 15 | 16 | # v1.1.6 17 | 18 | ## New Features 19 | 20 | * Produce build that does not modify prototypes ([@aidenlx](https://github.com/aidenlx "Link to profile for user aidenlx")), ([@dmaccormack](https://github.com/dmaccormack "Link to profile for user dmaccormack")) 21 | 22 | ## Dependency Updates 23 | 24 | The following dependencies were updated: 25 | 26 | * upgrade @babel/core from 7.14.5 to 7.17.5 27 | * upgrade @babel/cli from 7.14.5 to 7.17.3 28 | * upgrade @babel/plugin-transform-modules-commonjs from 7.14.5 to 7.16.7 29 | * upgrade @babel/preset-env from 7.14.5 to 7.16.11 30 | * upgrade babel-jest from 27.1.0 to 27.5.1 31 | * upgrade eslint-plugin-jest from 24.4.0 to 26.1.1 32 | * upgrade jest from 27.1.1 to 27.5.1 33 | * upgrade jsdoc from 3.6.7 to 3.6.10 34 | * upgrade jsdom from 16.6.0 to 17.0.0 35 | * upgrade rollup from 2.56.3 to 2.67.3 36 | * upgrade typescript from 4.4.2 to 4.5.5 37 | 38 | # v1.1.5 39 | 40 | ## Bug Fix 41 | 42 | * Fix bug in serializing number-like strings that include plus, with AQF ([@dmaccormack](https://github.com/dmaccormack "Link to profile for user dmaccormack")) 43 | 44 | ## New Feature 45 | 46 | * ignore null array/object member parse option ([@dmaccormack](https://github.com/dmaccormack "Link to profile for user dmaccormack")) 47 | 48 | ## Dependency Updates 49 | 50 | The following dependencies were updated: @babel/core, jsdom, multiple dependencies 51 | 52 | # v1.1.4 53 | 54 | ## Added 55 | 56 | * Add typescript declaration file [view commit](http://github.com/jsonurl/jsonurl-js/commit/13f1fd474b46ba68a544d9ae9a59a34bee0c8a4a) 57 | 58 | ## Changed 59 | 60 | * Update dependencies [view commit](http://github.com/jsonurl/jsonurl-js/commit/9dbebe2f823bb8de9f8a552c972933c1ad2f9866) 61 | 62 | # v1.1.3 63 | 64 | Unpublished. 65 | 66 | # v1.1.2 67 | 68 | ## Changed 69 | 70 | * Fix interface regression [view commit](http://github.com/jsonurl/jsonurl-js/commit/e4c83f8f13035aa63218d7717442460fdfb27cda) 71 | 72 | # v1.1.1 73 | 74 | ## Added 75 | 76 | * Add support for AQF syntax [view commit](http://github.com/jsonurl/jsonurl-js/commit/65a1b09918b5005487b18aa5c66d8fd4a30309aa) 77 | * Add parse and stringify option noEmptyComposite [view commit](http://github.com/jsonurl/jsonurl-js/commit/202fb34b0da3d7358085bea7af2a21e441519b9f) 78 | * Add getMissingValue() parse option [view commit](http://github.com/jsonurl/jsonurl-js/commit/450d00c3127dc63b6606e7891219888b45e6241a) 79 | * Add support for coercing null to empty string on parse/stringify [view commit](http://github.com/jsonurl/jsonurl-js/commit/a564595b984283306ddee1d2aea6cb6d156098a3) 80 | * Add support for empty keys and empty string values [view commit](http://github.com/jsonurl/jsonurl-js/commit/6b94a0dadfc3d5ea8f21218f9bbee1205772f68b) 81 | 82 | ## Changed 83 | 84 | * Ignore extraneous ampersands for wfu-implied-composite values [view commit](http://github.com/jsonurl/jsonurl-js/commit/f288b33fbe9e8e88450a56d0878155dd85c85d1d) 85 | * Upgrade dependencies [view commit](http://github.com/jsonurl/jsonurl-js/commit/045008b511250f9da45ce3f85ed16a05a3b887b4) 86 | * Fix bug when encoding more than one left/right paren in string literal [view commit](http://github.com/jsonurl/jsonurl-js/commit/217ef164776a4fa5c2bd8361fdc5e06b6c0a3c84) 87 | * Upgrade multiple dependencies 88 | 89 | # v1.0.3 90 | 91 | ## Added 92 | 93 | * Added support for implied string literals [view commit](http://github.com/jsonurl/jsonurl-js/commit/1ff72c6c590be33eb9792e3f26086d893e137534) 94 | 95 | # v1.0.2 96 | 97 | ## Added 98 | 99 | * Add support for x-www-form-urlencoded style separators [view commit](http://github.com/jsonurl/jsonurl-js/commit/2faa2482a176d69f8297f7ab095178dba164d74f) 100 | 101 | ## Changed 102 | 103 | * update: Fix edge case of apos followed by string literal [view commit](http://github.com/jsonurl/jsonurl-js/commit/4dc2f185bd4862fbe83f49857eca136142c7639e) 104 | * doc: Mark non-exported classes as private [view commit](http://github.com/jsonurl/jsonurl-js/commit/271ab69e76448002692801ff065bb67ac939415f) 105 | * upgrade @babel/cli to 7.11.6 106 | * upgrade eslint to 7.9.0 107 | * upgrade eslint-plugin-jest to 23.18.0 108 | * upgrade jest to 26.4.2 109 | * upgrade jsdoc to 3.6.6 110 | * upgrade prettier to 2.1.2 111 | * upgrade rollup to 2.28.1 112 | * upgrade @rollup/plugin-babel to 5.2.1 113 | * upgrade rollup-plugin-terser to 7.0.2 114 | 115 | # v1.0.1 116 | 117 | ## Added 118 | 119 | * Add support for implied arrays and objects [view commit](http://github.com/jsonurl/jsonurl-js/commit/ee83d9c5c6d6cbc1643c721ba223a004ee4e8781) 120 | * Add JSDoc support [view commit](http://github.com/jsonurl/jsonurl-js/commit/5706a2975632201ef574b23dc38d00bb2a154737) 121 | 122 | ## Changed 123 | 124 | * upgrade @babel/preset-env to 7.10.4 [view commit](http://github.com/jsonurl/jsonurl-js/commit/0e2019124c303847e21aa2bb0a63ef3bf528a64d) 125 | * upgrade rollup to 2.18.1 [view commit](http://github.com/jsonurl/jsonurl-js/commit/ef9ded9e4df15d0d2404f29245e80cc7ae161255) 126 | * upgrade lodash from 4.17.19 [view commit](http://github.com/jsonurl/jsonurl-js/commit/0d78ec646e2731923163fb9641995b5087e82b15) 127 | * upgrade eslint from to 7.3.1 [view commit](http://github.com/jsonurl/jsonurl-js/commit/131e5b073e7823d81f480b1f077f8dd1be3299b9) 128 | * upgrade eslint-plugin-prettier to 3.1.4 [view commit](http://github.com/jsonurl/jsonurl-js/commit/80b350a03e894b63a1e34a3cc362635b4f0ea532) 129 | * upgrade eslint-plugin-jest to 23.17.1 [view commit](http://github.com/jsonurl/jsonurl-js/commit/684957f78145c30bf2c306a644cb1be4268b7501) 130 | * Do not mix named and default exports [view commit](http://github.com/jsonurl/jsonurl-js/commit/dd772cae0c3501cec252a1ed42387de514b9c6a3) 131 | * Split the test suite into multiple files [view commit](http://github.com/jsonurl/jsonurl-js/commit/60cf88e968e7c408722dc16404150197529feeab) 132 | * Rename main.js -> JsonURL.js [view commit](http://github.com/jsonurl/jsonurl-js/commit/ee83d9c5c6d6cbc1643c721ba223a004ee4e8781) 133 | 134 | # v1.0.0 135 | 136 | * Initial release 137 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, religion, or sexual identity 11 | and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the 27 | overall community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or 32 | advances of any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email 36 | address, without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | jsonurl.org ``at'' gmail.com. 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series 87 | of actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or 94 | permanent ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within 114 | the community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.0, available at 120 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 121 | 122 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 123 | enforcement ladder](https://github.com/mozilla/diversity). 124 | 125 | [homepage]: https://www.contributor-covenant.org 126 | 127 | For answers to common questions about this code of conduct, see the FAQ at 128 | https://www.contributor-covenant.org/faq. Translations are available at 129 | https://www.contributor-covenant.org/translations. 130 | 131 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to jsonurl-js 2 | ====================== 3 | So you found a bug or want to contribute a new feature? Great! Before 4 | you dig into the code there are some guidelines I need contributors to follow 5 | so that I have a reasonable chance of keeping things organized without too much 6 | effort. 7 | 8 | Getting Started 9 | --------------- 10 | + Make sure you have a [GitHub account](https://github.com/signup/free). 11 | + If you just want to make a small change see "Making Trivial Changes" below. 12 | + See if there is already a 13 | [discussion][discussion] or 14 | [issue](https://github.com/jsonurl/jsonurl-js/issues), 15 | or create a new one if necessary 16 | + For defects, clearly describe the problem, including steps to reproduce 17 | + For features, clearly describe the idea, including intent, audience, and 18 | use cases 19 | + If you're planning to implement a new feature it's a good idea to 20 | [discuss][discussion] it first. 21 | This can help make sure you're not wasting your time on something that's 22 | considered out of scope. 23 | + Fork the repository on GitHub. 24 | 25 | Making and Submitting Changes 26 | -------------- 27 | I accept pull requests via GitHub. Here are some guidelines which will make 28 | applying PRs easier for me: 29 | + Create a topic/feature branch from the `main` branch to base your work, and 30 | push your changes to that branch in your fork of the repository 31 | + Make commits of logical units and with [meaningful][commit-message-howto], 32 | [conventional commit][cc] messages that reference the related 33 | GitHub issue. The following commit types are currently in use: 34 | + feat - A new feature 35 | + fix - A bug fix 36 | + docs - Documentation changes 37 | + style - Changes that do not affect code execution (e.g. formatting) 38 | + refactor - A code change that neither fixes a bug nor adds a feature 39 | + perf - A code change that improves performance 40 | + test - A change to test configuration, or one or more files in the `test` 41 | directory; must not affect the result of `npm run build` 42 | + chore - Changes to the build or workflow process; must not affect the 43 | result of `npm run build` 44 | + update - dependency update 45 | + Use the [style][eslintrc.js] of the existing codebase 46 | + Make sure you have added/updated tests for your changes, and that all tests 47 | pass 48 | + Submit a pull request once you're ready to merge 49 | 50 | Making Trivial Changes 51 | ---------------------- 52 | For small changes, like tweaks to comments and/or documentation you don't need 53 | to create an issue. A fork + PR with a proper commit message (i.e. docs: ...) 54 | is sufficient. 55 | 56 | [zulip]: https://jsonurl.zulipchat.com/#narrow/stream/248637-jsonurl-js 57 | [discussion]: https://github.com/jsonurl/jsonurl-js/discussions 58 | [eslintrc.js]: .eslintrc.js 59 | [commit-message-howto]: https://chris.beams.io/posts/git-commit/ 60 | [semantic-commit-message]: https://seesparkbox.com/foundry/semantic_commit_messages 61 | [cc]: https://www.conventionalcommits.org/en/v1.0.0/ 62 | 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 David MacCormack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JSON→URL 2 | 3 | [![License: MIT](https://img.shields.io/github/license/jsonurl/jsonurl-js.svg?label=License)][license] 4 | [![NPM version](https://img.shields.io/npm/v/@jsonurl/jsonurl.svg)](https://www.npmjs.com/package/@jsonurl/jsonurl) 5 | [![CI](https://github.com/jsonurl/jsonurl-js/workflows/ci/badge.svg?branch=main)](https://github.com/jsonurl/jsonurl-js/actions/workflows/ci.yml) 6 | [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\&metric=alert_status)](https://sonarcloud.io/dashboard?id=jsonurl-js) 7 | [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\&metric=coverage)](https://sonarcloud.io/dashboard?id=jsonurl-js) 8 | [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\&metric=ncloc)](https://sonarcloud.io/dashboard?id=jsonurl-js) 9 | [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\&metric=security_rating)](https://sonarcloud.io/dashboard?id=jsonurl-js) 10 | [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=jsonurl-js) 11 | [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=jsonurl-js) 12 | [![Known Vulnerabilities](https://snyk.io/test/github/jsonurl/jsonurl-js/badge.svg?targetFile=package.json)](https://snyk.io/test/github/jsonurl/jsonurl-js?targetFile=package.json) 13 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js?ref=badge_shield) 14 | [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) 15 | [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green)](CONTRIBUTING.md) 16 | [![project chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://jsonurl.zulipchat.com/) 17 | 18 | ## About 19 | 20 | [RFC8259][RFC8259] describes the JSON data model and interchange format, which is widely 21 | used in application-level protocols including RESTful APIs. It is common for 22 | applications to request resources via the HTTP POST method, with JSON entities. 23 | However, POST is suboptimal for requests which do not modify a resource's 24 | state. JSON→URL defines a text format for the JSON data model suitable 25 | for use within a [URL][RFC1738]/[URI][RFC3986]. 26 | 27 | ## Usage 28 | 29 | JSON→URL is available as a commonjs module (suitable for use in Node), ES6 30 | module, or a script that may be used directly in a browser. 31 | 32 | ### NPM install 33 | 34 | ```sh 35 | npm install @jsonurl/jsonurl --save 36 | ``` 37 | 38 | ### CJS 39 | 40 | ```js 41 | const JsonURL = require("@jsonurl/jsonurl"); 42 | ``` 43 | 44 | ### ES6 (Node + Babel) 45 | 46 | ```js 47 | import JsonURL from "@jsonurl/jsonurl"; 48 | ``` 49 | 50 | ### Browser script tag 51 | 52 | ```html 53 | 57 | ``` 58 | 59 | ### The JavaScript API 60 | 61 | Once included, the API is the same for all three. 62 | 63 | [![RunKit: Hello, World!](https://img.shields.io/badge/RunKit-Hello%2C%20World!-ff69b4)][runkit1] 64 | 65 | ```js 66 | let value = JsonURL.parse( "(Hello:World!)" ); 67 | let string = JsonURL.stringify( value ); 68 | ``` 69 | 70 | If you intend to use JSON→URL inside a browser's address bar then you'll want to 71 | enable the AQF (address bar query string friendly) syntax. 72 | 73 | [![RunKit: Hello, Browser Address Bar!](https://img.shields.io/badge/RunKit-Hello%2C%20Address%20Bar!-ff69b4)][runkit2] 74 | 75 | ```js 76 | let value = JsonURL.parse( "(Hello:Address Bar!!)", { AQF: true }); 77 | let string = JsonURL.stringify( value, { AQF: true } ); 78 | ``` 79 | 80 | ### Options - noEmptyComposite 81 | 82 | The JSON→URL specification defines the empty composite value, `()`, because an 83 | empty array is indistinguishable from an empty object. This works well in 84 | practice, generally, but it can lead to counterintuitive results when parsing 85 | JSON→URL text into a language-native object and then stringifying it back 86 | into JSON→URL text; the input text doesn't "round-trip" back to 87 | itself as expected. 88 | 89 | The `noEmptyComposite` parse option causes the character sequence `()` to be 90 | parsed as an empty array, and the character sequence `(:)` to be parsed as an 91 | empty object. And the `noEmptyComposite` stringify option instructs 92 | `stringify` to generate those strings appropriately. 93 | 94 | [![RunKit: noEmptyComposite](https://img.shields.io/badge/RunKit-noEmptyComposite-ff69b4)][runkit3] 95 | 96 | ```js 97 | let value = JsonURL.parse( "(Array:(true,false,(nested),()),Object:(nested:(:)))", { AQF: true, noEmptyComposite: true }); 98 | let string = JsonURL.stringify( value, { AQF: true, noEmptyComposite: true }); 99 | ``` 100 | 101 | ### Options - More 102 | 103 | There are additional options available. The [typescript definition][dts] file 104 | is a good place to learn more. 105 | 106 | JSON→URL has no runtime dependencies. 107 | 108 | ## Security 109 | 110 | The parser is designed to parse untrusted input. It supports limits on 111 | the number of parsed values and depth of nested arrays or objects. 112 | When the limit is exceeded an Error is thrown, and reasonable limit values are 113 | set by default. 114 | 115 | [RFC8259]: https://tools.ietf.org/html/rfc8259 116 | 117 | [RFC3986]: https://tools.ietf.org/html/rfc3986 118 | 119 | [RFC1738]: https://tools.ietf.org/html/rfc1738 120 | 121 | [license]: https://opensource.org/licenses/MIT 122 | 123 | [runkit1]: https://runkit.com/jsonurl/hello-world 124 | 125 | [runkit2]: https://runkit.com/jsonurl/hello-aqf 126 | 127 | [runkit3]: https://runkit.com/jsonurl/noemptycomposite 128 | 129 | [dts]: https://github.com/jsonurl/jsonurl-js/blob/main/jsonurl.d.ts 130 | 131 | ## License 132 | 133 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js?ref=badge_large) 134 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | The following versions are actively supported, including security updates. 6 | 7 | | Version | Supported | 8 | | ------- | ------------------ | 9 | | 1.1.8 | :white_check_mark: | 10 | | < 1.1.8 | :x: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | First: thank you for engaging in responsible disclosure! 15 | 16 | If you beleive you've found a vulnerability or other security related issue 17 | please email a complete description to jsonurl.org \`\`at'' gmail.com. 18 | If the issue is accepted a discussion will begin on a private 19 | [Zulip][zulip] channel, and you mabe be invited to participate. Once a fix 20 | is in place, and a new release is made, a GitHub security advisory will be 21 | created to make the information public. 22 | 23 | If the vulnerability is declined a Github issue may still be created, 24 | and/or the Zulip channel may be made public, to make the discussion public 25 | if the repository owners see value in that. Otherwise, we appreciate your 26 | engagement in responsible disclosure and you are now free to disclose 27 | the information (or not) as you see fit. 28 | 29 | [zulip]: https://jsonurl.zulipchat.com/ 30 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 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 | 25 | "use strict"; 26 | 27 | module.exports = (api) => { 28 | const isTest = api.env("test"); 29 | // You can use isTest to determine what presets and plugins to use. 30 | 31 | let opts; 32 | 33 | if (isTest) { 34 | opts = { 35 | targets: { node: "current" }, 36 | }; 37 | } 38 | 39 | return { 40 | plugins: ["@babel/plugin-syntax-import-assertions"], 41 | presets: [["@babel/preset-env", opts]], 42 | exclude: ["node_modules/**"], 43 | }; 44 | }; 45 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 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 | 25 | const babel = require("@babel/eslint-parser"); 26 | const jest = require("eslint-plugin-jest"); 27 | const prettier = require("eslint-plugin-prettier/recommended"); 28 | 29 | module.exports = [ 30 | prettier, 31 | { 32 | ignores: ["coverage/*", "**/dist/*", "apidoc/*", "backup/*"], 33 | }, 34 | { 35 | files: ["*.mjs", "src/*.js"], 36 | languageOptions: { 37 | sourceType: "module", 38 | parser: babel, 39 | parserOptions: { 40 | babelOptions: { 41 | configFile: "./babel.config.js", 42 | }, 43 | importAttributes: true, 44 | }, 45 | }, 46 | }, 47 | { 48 | files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"], 49 | plugins: { 50 | jest, 51 | }, 52 | ...jest.configs["flat/recommended"], 53 | }, 54 | ]; 55 | -------------------------------------------------------------------------------- /itest/cjs/main.js: -------------------------------------------------------------------------------- 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 | 25 | const JsonURL = require("@jsonurl/jsonurl"); 26 | const pkg = require("./package.json"); 27 | const expected = "(hello:world)"; 28 | 29 | function assert(actual) { 30 | if (actual !== expected) { 31 | console.log( 32 | pkg.description, 33 | ": expected '" + expected + "' but received '" + actual + "'" 34 | ); 35 | 36 | process.exit(1); 37 | } 38 | } 39 | 40 | const u = new JsonURL(); 41 | assert(JsonURL.stringify(u.parse(expected))); 42 | assert(JsonURL.stringify(JsonURL.parse(expected))); 43 | -------------------------------------------------------------------------------- /itest/cjs/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-commonjs", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@jsonurl/itest-commonjs", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@jsonurl/jsonurl": "file:../.." 13 | } 14 | }, 15 | "../..": { 16 | "version": "1.0.0-SNAPSHOT", 17 | "license": "MIT", 18 | "devDependencies": { 19 | "@babel/cli": "^7.15.4", 20 | "@babel/core": "^7.15.5", 21 | "@babel/preset-env": "^7.15.4", 22 | "@rollup/plugin-alias": "^5.0.0", 23 | "@rollup/plugin-babel": "^6.0.0", 24 | "@rollup/plugin-eslint": "^9", 25 | "@rollup/plugin-replace": "^5.0.0", 26 | "@rollup/plugin-terser": "^0.4", 27 | "babel-jest": "^29.2.0", 28 | "editorconfig": "^2.0.0", 29 | "eslint": "^8.25.0", 30 | "eslint-config-prettier": "^9.1.0", 31 | "eslint-plugin-jest": "^27.1.2", 32 | "eslint-plugin-prettier": "^4.2.1", 33 | "jest": "^29.2.0", 34 | "jsdoc": "^4.0.0", 35 | "prettier": "^2.7.1", 36 | "rollup": "^4", 37 | "typescript": "^5.3.3" 38 | } 39 | }, 40 | "node_modules/@jsonurl/jsonurl": { 41 | "resolved": "../..", 42 | "link": true 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /itest/cjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-commonjs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "JSON->URL commonjs integration test", 6 | "main": "main.js", 7 | "scripts": { 8 | "build": "", 9 | "test": "node ./" 10 | }, 11 | "author": "David MacCormack", 12 | "license": "MIT", 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/jsonurl/jsonurl-js.git" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/jsonurl/jsonurl-js/issues" 19 | }, 20 | "homepage": "https://www.jsonurl.org/", 21 | "dependencies": { 22 | "@jsonurl/jsonurl": "file:../.." 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /itest/es6-babel/babel.config.js: -------------------------------------------------------------------------------- 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 | 25 | "use strict"; 26 | 27 | module.exports = { 28 | plugins: ["@babel/plugin-transform-modules-commonjs"], 29 | }; 30 | -------------------------------------------------------------------------------- /itest/es6-babel/main.js: -------------------------------------------------------------------------------- 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 | 25 | import JsonURL from "@jsonurl/jsonurl"; 26 | import { readFileSync } from "fs"; 27 | const pkg = JSON.parse(readFileSync("package.json")); 28 | const expected = "(hello:world)"; 29 | 30 | function assert(result) { 31 | if (result !== expected) { 32 | console.log( 33 | pkg.description, 34 | ": expected '" + expected + "' but received '" + result + "'" 35 | ); 36 | 37 | process.exit(1); 38 | } 39 | } 40 | 41 | const u = new JsonURL(); 42 | assert(JsonURL.stringify(u.parse(expected))); 43 | assert(JsonURL.stringify(JsonURL.parse(expected))); 44 | -------------------------------------------------------------------------------- /itest/es6-babel/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-es6-babel", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@jsonurl/itest-es6-babel", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@babel/cli": "^7.24.8", 13 | "@babel/core": "^7.24.8", 14 | "@babel/plugin-transform-modules-commonjs": "^7.24.8", 15 | "@jsonurl/jsonurl": "file:../.." 16 | } 17 | }, 18 | "../..": { 19 | "version": "1.0.0-SNAPSHOT", 20 | "license": "MIT", 21 | "devDependencies": { 22 | "@babel/cli": "^7.15.4", 23 | "@babel/core": "^7.15.5", 24 | "@babel/preset-env": "^7.15.4", 25 | "@rollup/plugin-alias": "^5.0.0", 26 | "@rollup/plugin-babel": "^6.0.0", 27 | "@rollup/plugin-eslint": "^9", 28 | "@rollup/plugin-replace": "^5.0.0", 29 | "@rollup/plugin-terser": "^0.4", 30 | "babel-jest": "^29.2.0", 31 | "editorconfig": "^2.0.0", 32 | "eslint": "^8.25.0", 33 | "eslint-config-prettier": "^9.1.0", 34 | "eslint-plugin-jest": "^27.1.2", 35 | "eslint-plugin-prettier": "^4.2.1", 36 | "jest": "^29.2.0", 37 | "jsdoc": "^4.0.0", 38 | "prettier": "^2.7.1", 39 | "rollup": "^4", 40 | "typescript": "^5.3.3" 41 | } 42 | }, 43 | "node_modules/@ampproject/remapping": { 44 | "version": "2.3.0", 45 | "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", 46 | "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", 47 | "dependencies": { 48 | "@jridgewell/gen-mapping": "^0.3.5", 49 | "@jridgewell/trace-mapping": "^0.3.24" 50 | }, 51 | "engines": { 52 | "node": ">=6.0.0" 53 | } 54 | }, 55 | "node_modules/@babel/cli": { 56 | "version": "7.24.8", 57 | "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.24.8.tgz", 58 | "integrity": "sha512-isdp+G6DpRyKc+3Gqxy2rjzgF7Zj9K0mzLNnxz+E/fgeag8qT3vVulX4gY9dGO1q0y+0lUv6V3a+uhUzMzrwXg==", 59 | "license": "MIT", 60 | "dependencies": { 61 | "@jridgewell/trace-mapping": "^0.3.25", 62 | "commander": "^6.2.0", 63 | "convert-source-map": "^2.0.0", 64 | "fs-readdir-recursive": "^1.1.0", 65 | "glob": "^7.2.0", 66 | "make-dir": "^2.1.0", 67 | "slash": "^2.0.0" 68 | }, 69 | "bin": { 70 | "babel": "bin/babel.js", 71 | "babel-external-helpers": "bin/babel-external-helpers.js" 72 | }, 73 | "engines": { 74 | "node": ">=6.9.0" 75 | }, 76 | "optionalDependencies": { 77 | "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", 78 | "chokidar": "^3.4.0" 79 | }, 80 | "peerDependencies": { 81 | "@babel/core": "^7.0.0-0" 82 | } 83 | }, 84 | "node_modules/@babel/code-frame": { 85 | "version": "7.24.7", 86 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", 87 | "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", 88 | "dependencies": { 89 | "@babel/highlight": "^7.24.7", 90 | "picocolors": "^1.0.0" 91 | }, 92 | "engines": { 93 | "node": ">=6.9.0" 94 | } 95 | }, 96 | "node_modules/@babel/compat-data": { 97 | "version": "7.25.2", 98 | "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.2.tgz", 99 | "integrity": "sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ==", 100 | "license": "MIT", 101 | "engines": { 102 | "node": ">=6.9.0" 103 | } 104 | }, 105 | "node_modules/@babel/core": { 106 | "version": "7.24.8", 107 | "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.8.tgz", 108 | "integrity": "sha512-6AWcmZC/MZCO0yKys4uhg5NlxL0ESF3K6IAaoQ+xSXvPyPyxNWRafP+GDbI88Oh68O7QkJgmEtedWPM9U0pZNg==", 109 | "license": "MIT", 110 | "dependencies": { 111 | "@ampproject/remapping": "^2.2.0", 112 | "@babel/code-frame": "^7.24.7", 113 | "@babel/generator": "^7.24.8", 114 | "@babel/helper-compilation-targets": "^7.24.8", 115 | "@babel/helper-module-transforms": "^7.24.8", 116 | "@babel/helpers": "^7.24.8", 117 | "@babel/parser": "^7.24.8", 118 | "@babel/template": "^7.24.7", 119 | "@babel/traverse": "^7.24.8", 120 | "@babel/types": "^7.24.8", 121 | "convert-source-map": "^2.0.0", 122 | "debug": "^4.1.0", 123 | "gensync": "^1.0.0-beta.2", 124 | "json5": "^2.2.3", 125 | "semver": "^6.3.1" 126 | }, 127 | "engines": { 128 | "node": ">=6.9.0" 129 | }, 130 | "funding": { 131 | "type": "opencollective", 132 | "url": "https://opencollective.com/babel" 133 | } 134 | }, 135 | "node_modules/@babel/generator": { 136 | "version": "7.25.0", 137 | "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.0.tgz", 138 | "integrity": "sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw==", 139 | "license": "MIT", 140 | "dependencies": { 141 | "@babel/types": "^7.25.0", 142 | "@jridgewell/gen-mapping": "^0.3.5", 143 | "@jridgewell/trace-mapping": "^0.3.25", 144 | "jsesc": "^2.5.1" 145 | }, 146 | "engines": { 147 | "node": ">=6.9.0" 148 | } 149 | }, 150 | "node_modules/@babel/helper-compilation-targets": { 151 | "version": "7.25.2", 152 | "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz", 153 | "integrity": "sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==", 154 | "license": "MIT", 155 | "dependencies": { 156 | "@babel/compat-data": "^7.25.2", 157 | "@babel/helper-validator-option": "^7.24.8", 158 | "browserslist": "^4.23.1", 159 | "lru-cache": "^5.1.1", 160 | "semver": "^6.3.1" 161 | }, 162 | "engines": { 163 | "node": ">=6.9.0" 164 | } 165 | }, 166 | "node_modules/@babel/helper-module-imports": { 167 | "version": "7.24.7", 168 | "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", 169 | "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", 170 | "license": "MIT", 171 | "dependencies": { 172 | "@babel/traverse": "^7.24.7", 173 | "@babel/types": "^7.24.7" 174 | }, 175 | "engines": { 176 | "node": ">=6.9.0" 177 | } 178 | }, 179 | "node_modules/@babel/helper-module-transforms": { 180 | "version": "7.25.2", 181 | "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz", 182 | "integrity": "sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==", 183 | "license": "MIT", 184 | "dependencies": { 185 | "@babel/helper-module-imports": "^7.24.7", 186 | "@babel/helper-simple-access": "^7.24.7", 187 | "@babel/helper-validator-identifier": "^7.24.7", 188 | "@babel/traverse": "^7.25.2" 189 | }, 190 | "engines": { 191 | "node": ">=6.9.0" 192 | }, 193 | "peerDependencies": { 194 | "@babel/core": "^7.0.0" 195 | } 196 | }, 197 | "node_modules/@babel/helper-plugin-utils": { 198 | "version": "7.24.8", 199 | "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", 200 | "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", 201 | "license": "MIT", 202 | "engines": { 203 | "node": ">=6.9.0" 204 | } 205 | }, 206 | "node_modules/@babel/helper-simple-access": { 207 | "version": "7.24.7", 208 | "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", 209 | "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", 210 | "license": "MIT", 211 | "dependencies": { 212 | "@babel/traverse": "^7.24.7", 213 | "@babel/types": "^7.24.7" 214 | }, 215 | "engines": { 216 | "node": ">=6.9.0" 217 | } 218 | }, 219 | "node_modules/@babel/helper-string-parser": { 220 | "version": "7.24.8", 221 | "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", 222 | "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", 223 | "license": "MIT", 224 | "engines": { 225 | "node": ">=6.9.0" 226 | } 227 | }, 228 | "node_modules/@babel/helper-validator-identifier": { 229 | "version": "7.24.7", 230 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", 231 | "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", 232 | "engines": { 233 | "node": ">=6.9.0" 234 | } 235 | }, 236 | "node_modules/@babel/helper-validator-option": { 237 | "version": "7.24.8", 238 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", 239 | "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", 240 | "license": "MIT", 241 | "engines": { 242 | "node": ">=6.9.0" 243 | } 244 | }, 245 | "node_modules/@babel/helpers": { 246 | "version": "7.25.0", 247 | "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.0.tgz", 248 | "integrity": "sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw==", 249 | "license": "MIT", 250 | "dependencies": { 251 | "@babel/template": "^7.25.0", 252 | "@babel/types": "^7.25.0" 253 | }, 254 | "engines": { 255 | "node": ">=6.9.0" 256 | } 257 | }, 258 | "node_modules/@babel/highlight": { 259 | "version": "7.24.7", 260 | "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", 261 | "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", 262 | "dependencies": { 263 | "@babel/helper-validator-identifier": "^7.24.7", 264 | "chalk": "^2.4.2", 265 | "js-tokens": "^4.0.0", 266 | "picocolors": "^1.0.0" 267 | }, 268 | "engines": { 269 | "node": ">=6.9.0" 270 | } 271 | }, 272 | "node_modules/@babel/parser": { 273 | "version": "7.25.3", 274 | "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz", 275 | "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==", 276 | "license": "MIT", 277 | "dependencies": { 278 | "@babel/types": "^7.25.2" 279 | }, 280 | "bin": { 281 | "parser": "bin/babel-parser.js" 282 | }, 283 | "engines": { 284 | "node": ">=6.0.0" 285 | } 286 | }, 287 | "node_modules/@babel/plugin-transform-modules-commonjs": { 288 | "version": "7.24.8", 289 | "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", 290 | "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", 291 | "license": "MIT", 292 | "dependencies": { 293 | "@babel/helper-module-transforms": "^7.24.8", 294 | "@babel/helper-plugin-utils": "^7.24.8", 295 | "@babel/helper-simple-access": "^7.24.7" 296 | }, 297 | "engines": { 298 | "node": ">=6.9.0" 299 | }, 300 | "peerDependencies": { 301 | "@babel/core": "^7.0.0-0" 302 | } 303 | }, 304 | "node_modules/@babel/template": { 305 | "version": "7.25.0", 306 | "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", 307 | "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", 308 | "license": "MIT", 309 | "dependencies": { 310 | "@babel/code-frame": "^7.24.7", 311 | "@babel/parser": "^7.25.0", 312 | "@babel/types": "^7.25.0" 313 | }, 314 | "engines": { 315 | "node": ">=6.9.0" 316 | } 317 | }, 318 | "node_modules/@babel/traverse": { 319 | "version": "7.25.3", 320 | "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.3.tgz", 321 | "integrity": "sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ==", 322 | "license": "MIT", 323 | "dependencies": { 324 | "@babel/code-frame": "^7.24.7", 325 | "@babel/generator": "^7.25.0", 326 | "@babel/parser": "^7.25.3", 327 | "@babel/template": "^7.25.0", 328 | "@babel/types": "^7.25.2", 329 | "debug": "^4.3.1", 330 | "globals": "^11.1.0" 331 | }, 332 | "engines": { 333 | "node": ">=6.9.0" 334 | } 335 | }, 336 | "node_modules/@babel/types": { 337 | "version": "7.25.2", 338 | "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz", 339 | "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==", 340 | "license": "MIT", 341 | "dependencies": { 342 | "@babel/helper-string-parser": "^7.24.8", 343 | "@babel/helper-validator-identifier": "^7.24.7", 344 | "to-fast-properties": "^2.0.0" 345 | }, 346 | "engines": { 347 | "node": ">=6.9.0" 348 | } 349 | }, 350 | "node_modules/@jridgewell/gen-mapping": { 351 | "version": "0.3.5", 352 | "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", 353 | "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", 354 | "dependencies": { 355 | "@jridgewell/set-array": "^1.2.1", 356 | "@jridgewell/sourcemap-codec": "^1.4.10", 357 | "@jridgewell/trace-mapping": "^0.3.24" 358 | }, 359 | "engines": { 360 | "node": ">=6.0.0" 361 | } 362 | }, 363 | "node_modules/@jridgewell/resolve-uri": { 364 | "version": "3.1.2", 365 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", 366 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", 367 | "engines": { 368 | "node": ">=6.0.0" 369 | } 370 | }, 371 | "node_modules/@jridgewell/set-array": { 372 | "version": "1.2.1", 373 | "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", 374 | "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", 375 | "engines": { 376 | "node": ">=6.0.0" 377 | } 378 | }, 379 | "node_modules/@jridgewell/sourcemap-codec": { 380 | "version": "1.4.15", 381 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", 382 | "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" 383 | }, 384 | "node_modules/@jridgewell/trace-mapping": { 385 | "version": "0.3.25", 386 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", 387 | "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", 388 | "dependencies": { 389 | "@jridgewell/resolve-uri": "^3.1.0", 390 | "@jridgewell/sourcemap-codec": "^1.4.14" 391 | } 392 | }, 393 | "node_modules/@jsonurl/jsonurl": { 394 | "resolved": "../..", 395 | "link": true 396 | }, 397 | "node_modules/@nicolo-ribaudo/chokidar-2": { 398 | "version": "2.1.8-no-fsevents.3", 399 | "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", 400 | "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", 401 | "optional": true 402 | }, 403 | "node_modules/ansi-styles": { 404 | "version": "3.2.1", 405 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 406 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 407 | "dependencies": { 408 | "color-convert": "^1.9.0" 409 | }, 410 | "engines": { 411 | "node": ">=4" 412 | } 413 | }, 414 | "node_modules/anymatch": { 415 | "version": "3.1.3", 416 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", 417 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", 418 | "optional": true, 419 | "dependencies": { 420 | "normalize-path": "^3.0.0", 421 | "picomatch": "^2.0.4" 422 | }, 423 | "engines": { 424 | "node": ">= 8" 425 | } 426 | }, 427 | "node_modules/balanced-match": { 428 | "version": "1.0.2", 429 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 430 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" 431 | }, 432 | "node_modules/binary-extensions": { 433 | "version": "2.3.0", 434 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", 435 | "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", 436 | "optional": true, 437 | "engines": { 438 | "node": ">=8" 439 | }, 440 | "funding": { 441 | "url": "https://github.com/sponsors/sindresorhus" 442 | } 443 | }, 444 | "node_modules/brace-expansion": { 445 | "version": "1.1.11", 446 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 447 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 448 | "dependencies": { 449 | "balanced-match": "^1.0.0", 450 | "concat-map": "0.0.1" 451 | } 452 | }, 453 | "node_modules/braces": { 454 | "version": "3.0.3", 455 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", 456 | "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", 457 | "optional": true, 458 | "dependencies": { 459 | "fill-range": "^7.1.1" 460 | }, 461 | "engines": { 462 | "node": ">=8" 463 | } 464 | }, 465 | "node_modules/browserslist": { 466 | "version": "4.23.3", 467 | "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", 468 | "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", 469 | "funding": [ 470 | { 471 | "type": "opencollective", 472 | "url": "https://opencollective.com/browserslist" 473 | }, 474 | { 475 | "type": "tidelift", 476 | "url": "https://tidelift.com/funding/github/npm/browserslist" 477 | }, 478 | { 479 | "type": "github", 480 | "url": "https://github.com/sponsors/ai" 481 | } 482 | ], 483 | "license": "MIT", 484 | "dependencies": { 485 | "caniuse-lite": "^1.0.30001646", 486 | "electron-to-chromium": "^1.5.4", 487 | "node-releases": "^2.0.18", 488 | "update-browserslist-db": "^1.1.0" 489 | }, 490 | "bin": { 491 | "browserslist": "cli.js" 492 | }, 493 | "engines": { 494 | "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" 495 | } 496 | }, 497 | "node_modules/caniuse-lite": { 498 | "version": "1.0.30001646", 499 | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001646.tgz", 500 | "integrity": "sha512-dRg00gudiBDDTmUhClSdv3hqRfpbOnU28IpI1T6PBTLWa+kOj0681C8uML3PifYfREuBrVjDGhL3adYpBT6spw==", 501 | "funding": [ 502 | { 503 | "type": "opencollective", 504 | "url": "https://opencollective.com/browserslist" 505 | }, 506 | { 507 | "type": "tidelift", 508 | "url": "https://tidelift.com/funding/github/npm/caniuse-lite" 509 | }, 510 | { 511 | "type": "github", 512 | "url": "https://github.com/sponsors/ai" 513 | } 514 | ], 515 | "license": "CC-BY-4.0" 516 | }, 517 | "node_modules/chalk": { 518 | "version": "2.4.2", 519 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 520 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 521 | "dependencies": { 522 | "ansi-styles": "^3.2.1", 523 | "escape-string-regexp": "^1.0.5", 524 | "supports-color": "^5.3.0" 525 | }, 526 | "engines": { 527 | "node": ">=4" 528 | } 529 | }, 530 | "node_modules/chokidar": { 531 | "version": "3.6.0", 532 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", 533 | "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", 534 | "optional": true, 535 | "dependencies": { 536 | "anymatch": "~3.1.2", 537 | "braces": "~3.0.2", 538 | "glob-parent": "~5.1.2", 539 | "is-binary-path": "~2.1.0", 540 | "is-glob": "~4.0.1", 541 | "normalize-path": "~3.0.0", 542 | "readdirp": "~3.6.0" 543 | }, 544 | "engines": { 545 | "node": ">= 8.10.0" 546 | }, 547 | "funding": { 548 | "url": "https://paulmillr.com/funding/" 549 | }, 550 | "optionalDependencies": { 551 | "fsevents": "~2.3.2" 552 | } 553 | }, 554 | "node_modules/color-convert": { 555 | "version": "1.9.3", 556 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 557 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 558 | "dependencies": { 559 | "color-name": "1.1.3" 560 | } 561 | }, 562 | "node_modules/color-name": { 563 | "version": "1.1.3", 564 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 565 | "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" 566 | }, 567 | "node_modules/commander": { 568 | "version": "6.2.1", 569 | "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", 570 | "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", 571 | "engines": { 572 | "node": ">= 6" 573 | } 574 | }, 575 | "node_modules/concat-map": { 576 | "version": "0.0.1", 577 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 578 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" 579 | }, 580 | "node_modules/convert-source-map": { 581 | "version": "2.0.0", 582 | "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", 583 | "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" 584 | }, 585 | "node_modules/debug": { 586 | "version": "4.3.5", 587 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", 588 | "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", 589 | "dependencies": { 590 | "ms": "2.1.2" 591 | }, 592 | "engines": { 593 | "node": ">=6.0" 594 | }, 595 | "peerDependenciesMeta": { 596 | "supports-color": { 597 | "optional": true 598 | } 599 | } 600 | }, 601 | "node_modules/electron-to-chromium": { 602 | "version": "1.5.4", 603 | "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.4.tgz", 604 | "integrity": "sha512-orzA81VqLyIGUEA77YkVA1D+N+nNfl2isJVjjmOyrlxuooZ19ynb+dOlaDTqd/idKRS9lDCSBmtzM+kyCsMnkA==", 605 | "license": "ISC" 606 | }, 607 | "node_modules/escalade": { 608 | "version": "3.1.2", 609 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", 610 | "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", 611 | "license": "MIT", 612 | "engines": { 613 | "node": ">=6" 614 | } 615 | }, 616 | "node_modules/escape-string-regexp": { 617 | "version": "1.0.5", 618 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 619 | "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", 620 | "engines": { 621 | "node": ">=0.8.0" 622 | } 623 | }, 624 | "node_modules/fill-range": { 625 | "version": "7.1.1", 626 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", 627 | "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", 628 | "optional": true, 629 | "dependencies": { 630 | "to-regex-range": "^5.0.1" 631 | }, 632 | "engines": { 633 | "node": ">=8" 634 | } 635 | }, 636 | "node_modules/fs-readdir-recursive": { 637 | "version": "1.1.0", 638 | "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", 639 | "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==" 640 | }, 641 | "node_modules/fs.realpath": { 642 | "version": "1.0.0", 643 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 644 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" 645 | }, 646 | "node_modules/fsevents": { 647 | "version": "2.3.3", 648 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", 649 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", 650 | "hasInstallScript": true, 651 | "optional": true, 652 | "os": [ 653 | "darwin" 654 | ], 655 | "engines": { 656 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 657 | } 658 | }, 659 | "node_modules/gensync": { 660 | "version": "1.0.0-beta.2", 661 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", 662 | "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", 663 | "engines": { 664 | "node": ">=6.9.0" 665 | } 666 | }, 667 | "node_modules/glob": { 668 | "version": "7.2.3", 669 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", 670 | "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", 671 | "deprecated": "Glob versions prior to v9 are no longer supported", 672 | "dependencies": { 673 | "fs.realpath": "^1.0.0", 674 | "inflight": "^1.0.4", 675 | "inherits": "2", 676 | "minimatch": "^3.1.1", 677 | "once": "^1.3.0", 678 | "path-is-absolute": "^1.0.0" 679 | }, 680 | "engines": { 681 | "node": "*" 682 | }, 683 | "funding": { 684 | "url": "https://github.com/sponsors/isaacs" 685 | } 686 | }, 687 | "node_modules/glob-parent": { 688 | "version": "5.1.2", 689 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 690 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 691 | "optional": true, 692 | "dependencies": { 693 | "is-glob": "^4.0.1" 694 | }, 695 | "engines": { 696 | "node": ">= 6" 697 | } 698 | }, 699 | "node_modules/globals": { 700 | "version": "11.12.0", 701 | "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", 702 | "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", 703 | "license": "MIT", 704 | "engines": { 705 | "node": ">=4" 706 | } 707 | }, 708 | "node_modules/has-flag": { 709 | "version": "3.0.0", 710 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 711 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", 712 | "engines": { 713 | "node": ">=4" 714 | } 715 | }, 716 | "node_modules/inflight": { 717 | "version": "1.0.6", 718 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 719 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 720 | "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", 721 | "dependencies": { 722 | "once": "^1.3.0", 723 | "wrappy": "1" 724 | } 725 | }, 726 | "node_modules/inherits": { 727 | "version": "2.0.4", 728 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 729 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 730 | }, 731 | "node_modules/is-binary-path": { 732 | "version": "2.1.0", 733 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 734 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 735 | "optional": true, 736 | "dependencies": { 737 | "binary-extensions": "^2.0.0" 738 | }, 739 | "engines": { 740 | "node": ">=8" 741 | } 742 | }, 743 | "node_modules/is-extglob": { 744 | "version": "2.1.1", 745 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 746 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 747 | "optional": true, 748 | "engines": { 749 | "node": ">=0.10.0" 750 | } 751 | }, 752 | "node_modules/is-glob": { 753 | "version": "4.0.3", 754 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 755 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 756 | "optional": true, 757 | "dependencies": { 758 | "is-extglob": "^2.1.1" 759 | }, 760 | "engines": { 761 | "node": ">=0.10.0" 762 | } 763 | }, 764 | "node_modules/is-number": { 765 | "version": "7.0.0", 766 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 767 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 768 | "optional": true, 769 | "engines": { 770 | "node": ">=0.12.0" 771 | } 772 | }, 773 | "node_modules/js-tokens": { 774 | "version": "4.0.0", 775 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 776 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" 777 | }, 778 | "node_modules/jsesc": { 779 | "version": "2.5.2", 780 | "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", 781 | "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", 782 | "license": "MIT", 783 | "bin": { 784 | "jsesc": "bin/jsesc" 785 | }, 786 | "engines": { 787 | "node": ">=4" 788 | } 789 | }, 790 | "node_modules/json5": { 791 | "version": "2.2.3", 792 | "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", 793 | "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", 794 | "bin": { 795 | "json5": "lib/cli.js" 796 | }, 797 | "engines": { 798 | "node": ">=6" 799 | } 800 | }, 801 | "node_modules/lru-cache": { 802 | "version": "5.1.1", 803 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", 804 | "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", 805 | "license": "ISC", 806 | "dependencies": { 807 | "yallist": "^3.0.2" 808 | } 809 | }, 810 | "node_modules/make-dir": { 811 | "version": "2.1.0", 812 | "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", 813 | "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", 814 | "dependencies": { 815 | "pify": "^4.0.1", 816 | "semver": "^5.6.0" 817 | }, 818 | "engines": { 819 | "node": ">=6" 820 | } 821 | }, 822 | "node_modules/make-dir/node_modules/semver": { 823 | "version": "5.7.2", 824 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", 825 | "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", 826 | "bin": { 827 | "semver": "bin/semver" 828 | } 829 | }, 830 | "node_modules/minimatch": { 831 | "version": "3.1.2", 832 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 833 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 834 | "dependencies": { 835 | "brace-expansion": "^1.1.7" 836 | }, 837 | "engines": { 838 | "node": "*" 839 | } 840 | }, 841 | "node_modules/ms": { 842 | "version": "2.1.2", 843 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 844 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 845 | }, 846 | "node_modules/node-releases": { 847 | "version": "2.0.18", 848 | "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", 849 | "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", 850 | "license": "MIT" 851 | }, 852 | "node_modules/normalize-path": { 853 | "version": "3.0.0", 854 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 855 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 856 | "optional": true, 857 | "engines": { 858 | "node": ">=0.10.0" 859 | } 860 | }, 861 | "node_modules/once": { 862 | "version": "1.4.0", 863 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 864 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 865 | "dependencies": { 866 | "wrappy": "1" 867 | } 868 | }, 869 | "node_modules/path-is-absolute": { 870 | "version": "1.0.1", 871 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 872 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 873 | "engines": { 874 | "node": ">=0.10.0" 875 | } 876 | }, 877 | "node_modules/picocolors": { 878 | "version": "1.0.1", 879 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", 880 | "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" 881 | }, 882 | "node_modules/picomatch": { 883 | "version": "2.3.1", 884 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 885 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 886 | "optional": true, 887 | "engines": { 888 | "node": ">=8.6" 889 | }, 890 | "funding": { 891 | "url": "https://github.com/sponsors/jonschlinkert" 892 | } 893 | }, 894 | "node_modules/pify": { 895 | "version": "4.0.1", 896 | "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", 897 | "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", 898 | "engines": { 899 | "node": ">=6" 900 | } 901 | }, 902 | "node_modules/readdirp": { 903 | "version": "3.6.0", 904 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 905 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 906 | "optional": true, 907 | "dependencies": { 908 | "picomatch": "^2.2.1" 909 | }, 910 | "engines": { 911 | "node": ">=8.10.0" 912 | } 913 | }, 914 | "node_modules/semver": { 915 | "version": "6.3.1", 916 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", 917 | "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", 918 | "license": "ISC", 919 | "bin": { 920 | "semver": "bin/semver.js" 921 | } 922 | }, 923 | "node_modules/slash": { 924 | "version": "2.0.0", 925 | "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", 926 | "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", 927 | "engines": { 928 | "node": ">=6" 929 | } 930 | }, 931 | "node_modules/supports-color": { 932 | "version": "5.5.0", 933 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 934 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 935 | "dependencies": { 936 | "has-flag": "^3.0.0" 937 | }, 938 | "engines": { 939 | "node": ">=4" 940 | } 941 | }, 942 | "node_modules/to-fast-properties": { 943 | "version": "2.0.0", 944 | "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", 945 | "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", 946 | "engines": { 947 | "node": ">=4" 948 | } 949 | }, 950 | "node_modules/to-regex-range": { 951 | "version": "5.0.1", 952 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 953 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 954 | "optional": true, 955 | "dependencies": { 956 | "is-number": "^7.0.0" 957 | }, 958 | "engines": { 959 | "node": ">=8.0" 960 | } 961 | }, 962 | "node_modules/update-browserslist-db": { 963 | "version": "1.1.0", 964 | "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", 965 | "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", 966 | "funding": [ 967 | { 968 | "type": "opencollective", 969 | "url": "https://opencollective.com/browserslist" 970 | }, 971 | { 972 | "type": "tidelift", 973 | "url": "https://tidelift.com/funding/github/npm/browserslist" 974 | }, 975 | { 976 | "type": "github", 977 | "url": "https://github.com/sponsors/ai" 978 | } 979 | ], 980 | "license": "MIT", 981 | "dependencies": { 982 | "escalade": "^3.1.2", 983 | "picocolors": "^1.0.1" 984 | }, 985 | "bin": { 986 | "update-browserslist-db": "cli.js" 987 | }, 988 | "peerDependencies": { 989 | "browserslist": ">= 4.21.0" 990 | } 991 | }, 992 | "node_modules/wrappy": { 993 | "version": "1.0.2", 994 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 995 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 996 | }, 997 | "node_modules/yallist": { 998 | "version": "3.1.1", 999 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", 1000 | "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", 1001 | "license": "ISC" 1002 | } 1003 | } 1004 | } 1005 | -------------------------------------------------------------------------------- /itest/es6-babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-es6-babel", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "JSON->URL node+babel ES6 integration test", 6 | "main": "dist/main.js", 7 | "scripts": { 8 | "build": "babel main.js -d dist", 9 | "test": "node ./" 10 | }, 11 | "author": "David MacCormack", 12 | "license": "MIT", 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/jsonurl/jsonurl-js.git" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/jsonurl/jsonurl-js/issues" 19 | }, 20 | "homepage": "https://www.jsonurl.org/", 21 | "dependencies": { 22 | "@babel/cli": "^7.24.8", 23 | "@babel/core": "^7.24.8", 24 | "@babel/plugin-transform-modules-commonjs": "^7.24.8", 25 | "@jsonurl/jsonurl": "file:../.." 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /itest/es6-native/main.js: -------------------------------------------------------------------------------- 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 | 25 | import JsonURL from "@jsonurl/jsonurl"; 26 | import { readFileSync } from "fs"; 27 | const pkg = JSON.parse(readFileSync("package.json")); 28 | const expected = "(hello:world)"; 29 | 30 | function assert(actual) { 31 | if (actual !== expected) { 32 | console.log( 33 | pkg.description, 34 | ": expected '" + expected + "' but received '" + actual + "'" 35 | ); 36 | 37 | process.exit(1); 38 | } 39 | } 40 | 41 | const u = new JsonURL(); 42 | assert(JsonURL.stringify(u.parse(expected))); 43 | assert(JsonURL.stringify(JsonURL.parse(expected))); 44 | -------------------------------------------------------------------------------- /itest/es6-native/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-es6-native", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@jsonurl/itest-es6-native", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@jsonurl/jsonurl": "file:../.." 13 | } 14 | }, 15 | "../..": { 16 | "version": "1.0.0-SNAPSHOT", 17 | "license": "MIT", 18 | "devDependencies": { 19 | "@babel/cli": "^7.15.4", 20 | "@babel/core": "^7.15.5", 21 | "@babel/preset-env": "^7.15.4", 22 | "@rollup/plugin-alias": "^5.0.0", 23 | "@rollup/plugin-babel": "^6.0.0", 24 | "@rollup/plugin-eslint": "^9", 25 | "@rollup/plugin-replace": "^5.0.0", 26 | "@rollup/plugin-terser": "^0.4", 27 | "babel-jest": "^29.2.0", 28 | "editorconfig": "^2.0.0", 29 | "eslint": "^8.25.0", 30 | "eslint-config-prettier": "^9.1.0", 31 | "eslint-plugin-jest": "^27.1.2", 32 | "eslint-plugin-prettier": "^4.2.1", 33 | "jest": "^29.2.0", 34 | "jsdoc": "^4.0.0", 35 | "prettier": "^2.7.1", 36 | "rollup": "^4", 37 | "typescript": "^5.3.3" 38 | } 39 | }, 40 | "node_modules/@jsonurl/jsonurl": { 41 | "resolved": "../..", 42 | "link": true 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /itest/es6-native/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-es6-native", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "JSON->URL node native ES6 integration test", 6 | "main": "main.js", 7 | "type": "module", 8 | "scripts": { 9 | "build": "", 10 | "test": "node ./" 11 | }, 12 | "author": "David MacCormack", 13 | "license": "MIT", 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/jsonurl/jsonurl-js.git" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/jsonurl/jsonurl-js/issues" 20 | }, 21 | "homepage": "https://www.jsonurl.org/", 22 | "dependencies": { 23 | "@jsonurl/jsonurl": "file:../.." 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /itest/es6-ts/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # typescript generated 3 | *.js 4 | *.js.map 5 | 6 | -------------------------------------------------------------------------------- /itest/es6-ts/main.ts: -------------------------------------------------------------------------------- 1 | 2 | import JsonURL from "@jsonurl/jsonurl"; 3 | import { readFileSync } from "fs"; 4 | const pkg = JSON.parse(String(readFileSync("package.json"))); 5 | const expected = "(hello:world)"; 6 | 7 | function assert(actual) { 8 | if (actual !== expected) { 9 | console.log( 10 | pkg.description, 11 | ": expected '" + expected + "' but received '" + actual + "'" 12 | ); 13 | 14 | process.exit(1); 15 | } 16 | } 17 | 18 | assert(JsonURL.stringify(JsonURL.parse(expected))); 19 | 20 | -------------------------------------------------------------------------------- /itest/es6-ts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-es6-ts", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@jsonurl/itest-es6-ts", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@jsonurl/jsonurl": "file:../..", 13 | "typescript": "^4.8.4" 14 | } 15 | }, 16 | "../..": { 17 | "version": "1.0.0-SNAPSHOT", 18 | "license": "MIT", 19 | "devDependencies": { 20 | "@babel/cli": "^7.15.4", 21 | "@babel/core": "^7.15.5", 22 | "@babel/preset-env": "^7.15.4", 23 | "@rollup/plugin-alias": "^5.0.0", 24 | "@rollup/plugin-babel": "^6.0.0", 25 | "@rollup/plugin-eslint": "^9", 26 | "@rollup/plugin-replace": "^5.0.0", 27 | "@rollup/plugin-terser": "^0.4", 28 | "babel-jest": "^29.2.0", 29 | "editorconfig": "^2.0.0", 30 | "eslint": "^8.25.0", 31 | "eslint-config-prettier": "^9.1.0", 32 | "eslint-plugin-jest": "^27.1.2", 33 | "eslint-plugin-prettier": "^4.2.1", 34 | "jest": "^29.2.0", 35 | "jsdoc": "^4.0.0", 36 | "prettier": "^2.7.1", 37 | "rollup": "^4", 38 | "typescript": "^5.3.3" 39 | } 40 | }, 41 | "node_modules/@jsonurl/jsonurl": { 42 | "resolved": "../..", 43 | "link": true 44 | }, 45 | "node_modules/typescript": { 46 | "version": "4.9.5", 47 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 48 | "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 49 | "bin": { 50 | "tsc": "bin/tsc", 51 | "tsserver": "bin/tsserver" 52 | }, 53 | "engines": { 54 | "node": ">=4.2.0" 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /itest/es6-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-es6-ts", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "JSON->URL node ES6+Typescript integration test", 6 | "main": "main.js", 7 | "type": "module", 8 | "scripts": { 9 | "build": "npx tsc", 10 | "test": "node ./" 11 | }, 12 | "author": "David MacCormack", 13 | "license": "MIT", 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/jsonurl/jsonurl-js.git" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/jsonurl/jsonurl-js/issues" 20 | }, 21 | "homepage": "https://www.jsonurl.org/", 22 | "dependencies": { 23 | "@jsonurl/jsonurl": "file:../..", 24 | "typescript": "^4.8.4" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /itest/es6-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "moduleResolution": "node", 5 | "sourceMap": true 6 | } 7 | } -------------------------------------------------------------------------------- /itest/itest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Node.js major version number 5 | # 6 | node_major=`node --version | sed -n 's/^v\([0-9][0-9]*\).*/\1/p'` 7 | 8 | # 9 | # run the integration test in the given directory 10 | # 11 | itest() { 12 | test_dir="$1" 13 | test_opt="$2" 14 | 15 | (cd "$test_dir" && npm uninstall @jsonurl/jsonurl ; npm install ../../) 16 | (cd "$test_dir" && npm ci && npm run build || exit 1) || return 1 17 | 18 | if test -z "$test_exp"; then 19 | (cd "$test_dir" && npm test || exit 1) || return 1 20 | else 21 | (cd "$test_dir" && env NODE_OPTIONS="$test_opt" npm test || exit 1) || return 1 22 | fi 23 | 24 | return 0 25 | } 26 | 27 | # 28 | # print the status for the given integration test 29 | # 30 | itest_status() { 31 | test_dir=$1 32 | test_status=$2 33 | 34 | test_desc=`sed -n 's/\s*"description"\s*:\s*"\([^"]*\)".*/\1/p' "$test_dir/package.json"` 35 | 36 | test_msg='Success' 37 | 38 | if test -z "$test_status" ; then 39 | test_msg='Skipped' 40 | elif test $test_status -ne 0 ; then 41 | test_msg='Fail' 42 | fi 43 | 44 | echo "$test_desc: $test_msg" 45 | } 46 | 47 | itest_exit() { 48 | test_dir=$1 49 | test_status=$2 50 | test -z "$test_status" && return 51 | test $test_status -eq 0 && return 52 | echo "Error: $test_dir" 53 | exit 1 54 | } 55 | 56 | ## 57 | # MAIN 58 | ## 59 | 60 | cd `dirname $0` 61 | 62 | test_cjs_status=0 63 | itest cjs || test_cjs_status=1 64 | 65 | test_es6babel_status=0 66 | itest es6-babel || test_es6babel_status=1 67 | 68 | test_jsdom_status=0 69 | itest jsdom || test_jsdom_status=1 70 | 71 | test_es6ts_status=0 72 | itest es6-ts || test_es6ts_status=1 73 | 74 | # 75 | # This test depends on the version of node. 76 | # node < 11 : no support for native ES6 modules 77 | # node 11-12 : experimental support for native ES6 modules 78 | # node 13+ : support for native ES6 modules enabled by default 79 | # 80 | if test "$node_major" -lt 11 ; then 81 | test_es6native_status= 82 | echo "ES6 native SKIPPED" 83 | elif test "$node_major" -lt 13 ; then 84 | test_es6native_status=0 85 | itest es6-native "--experimental-modules" || test_es6native_status=1 86 | else 87 | test_es6native_status=0 88 | itest es6-native || test_es6native_status=1 89 | fi 90 | 91 | echo 92 | echo "+---------+" 93 | echo "| Results |" 94 | echo "+---------+" 95 | itest_status cjs $test_cjs_status 96 | itest_status es6-babel $test_es6babel_status 97 | itest_status es6-native $test_es6native_status 98 | itest_status jsdom $test_jsdom_status 99 | itest_status es6-ts $test_es6ts_status 100 | 101 | itest_exit cjs $test_cjs_exit 102 | itest_exit es6-babel $test_es6babel_exit 103 | itest_exit es6-native $test_es6native_exit 104 | itest_exit jsdom $test_jsdom_exit 105 | itest_exit es6-ts $test_es6ts_exit 106 | 107 | exit 0 108 | 109 | -------------------------------------------------------------------------------- /itest/jsdom/main.js: -------------------------------------------------------------------------------- 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 | 25 | const fs = require("fs"); 26 | const pkg = require("./package.json"); 27 | const jsdom = require("jsdom"); 28 | const { JSDOM } = jsdom; 29 | const expected = "(hello:world)"; 30 | 31 | function assert(actual) { 32 | if (actual !== expected) { 33 | console.log( 34 | pkg.description, 35 | ": expected '" + expected + "' but received '" + actual + "'" 36 | ); 37 | 38 | process.exit(1); 39 | } 40 | } 41 | 42 | function run(script) { 43 | const jsonurlScript = 44 | ""; 45 | 46 | const testScript = 47 | "\n"; 55 | 56 | const html = 57 | "" + 58 | "

Placeholder

" + 59 | jsonurlScript + 60 | testScript + 61 | ""; 62 | 63 | const dom = new JSDOM(html, { 64 | url: "https://jsonurl.org/", 65 | referrer: "https://jsonurl.org/", 66 | contentType: "text/html", 67 | includeNodeLocations: true, 68 | runScripts: "dangerously", 69 | }); 70 | 71 | assert(dom.window.document.body.querySelector("p").textContent); 72 | } 73 | 74 | run("JsonURL.stringify(new JsonURL().parse(expected));\n"); 75 | run("JsonURL.stringify(JsonURL.parse(expected));\n"); 76 | -------------------------------------------------------------------------------- /itest/jsdom/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-jsdom", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@jsonurl/itest-jsdom", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@jsonurl/jsonurl": "file:../..", 13 | "jsdom": "^24.1.0" 14 | } 15 | }, 16 | "../..": { 17 | "version": "1.0.0-SNAPSHOT", 18 | "license": "MIT", 19 | "devDependencies": { 20 | "@babel/cli": "^7.15.4", 21 | "@babel/core": "^7.15.5", 22 | "@babel/preset-env": "^7.15.4", 23 | "@rollup/plugin-alias": "^5.0.0", 24 | "@rollup/plugin-babel": "^6.0.0", 25 | "@rollup/plugin-eslint": "^9", 26 | "@rollup/plugin-replace": "^5.0.0", 27 | "@rollup/plugin-terser": "^0.4", 28 | "babel-jest": "^29.2.0", 29 | "editorconfig": "^2.0.0", 30 | "eslint": "^8.25.0", 31 | "eslint-config-prettier": "^9.1.0", 32 | "eslint-plugin-jest": "^27.1.2", 33 | "eslint-plugin-prettier": "^4.2.1", 34 | "jest": "^29.2.0", 35 | "jsdoc": "^4.0.0", 36 | "prettier": "^2.7.1", 37 | "rollup": "^4", 38 | "typescript": "^5.3.3" 39 | } 40 | }, 41 | "node_modules/@jsonurl/jsonurl": { 42 | "resolved": "../..", 43 | "link": true 44 | }, 45 | "node_modules/agent-base": { 46 | "version": "7.1.1", 47 | "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", 48 | "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", 49 | "license": "MIT", 50 | "dependencies": { 51 | "debug": "^4.3.4" 52 | }, 53 | "engines": { 54 | "node": ">= 14" 55 | } 56 | }, 57 | "node_modules/asynckit": { 58 | "version": "0.4.0", 59 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 60 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" 61 | }, 62 | "node_modules/combined-stream": { 63 | "version": "1.0.8", 64 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 65 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 66 | "dependencies": { 67 | "delayed-stream": "~1.0.0" 68 | }, 69 | "engines": { 70 | "node": ">= 0.8" 71 | } 72 | }, 73 | "node_modules/cssstyle": { 74 | "version": "4.0.1", 75 | "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.0.1.tgz", 76 | "integrity": "sha512-8ZYiJ3A/3OkDd093CBT/0UKDWry7ak4BdPTFP2+QEP7cmhouyq/Up709ASSj2cK02BbZiMgk7kYjZNS4QP5qrQ==", 77 | "license": "MIT", 78 | "dependencies": { 79 | "rrweb-cssom": "^0.6.0" 80 | }, 81 | "engines": { 82 | "node": ">=18" 83 | } 84 | }, 85 | "node_modules/cssstyle/node_modules/rrweb-cssom": { 86 | "version": "0.6.0", 87 | "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", 88 | "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==", 89 | "license": "MIT" 90 | }, 91 | "node_modules/data-urls": { 92 | "version": "5.0.0", 93 | "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", 94 | "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", 95 | "license": "MIT", 96 | "dependencies": { 97 | "whatwg-mimetype": "^4.0.0", 98 | "whatwg-url": "^14.0.0" 99 | }, 100 | "engines": { 101 | "node": ">=18" 102 | } 103 | }, 104 | "node_modules/debug": { 105 | "version": "4.3.5", 106 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", 107 | "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", 108 | "license": "MIT", 109 | "dependencies": { 110 | "ms": "2.1.2" 111 | }, 112 | "engines": { 113 | "node": ">=6.0" 114 | }, 115 | "peerDependenciesMeta": { 116 | "supports-color": { 117 | "optional": true 118 | } 119 | } 120 | }, 121 | "node_modules/decimal.js": { 122 | "version": "10.4.3", 123 | "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", 124 | "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" 125 | }, 126 | "node_modules/delayed-stream": { 127 | "version": "1.0.0", 128 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 129 | "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", 130 | "engines": { 131 | "node": ">=0.4.0" 132 | } 133 | }, 134 | "node_modules/entities": { 135 | "version": "4.5.0", 136 | "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", 137 | "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", 138 | "license": "BSD-2-Clause", 139 | "engines": { 140 | "node": ">=0.12" 141 | }, 142 | "funding": { 143 | "url": "https://github.com/fb55/entities?sponsor=1" 144 | } 145 | }, 146 | "node_modules/form-data": { 147 | "version": "4.0.0", 148 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", 149 | "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", 150 | "dependencies": { 151 | "asynckit": "^0.4.0", 152 | "combined-stream": "^1.0.8", 153 | "mime-types": "^2.1.12" 154 | }, 155 | "engines": { 156 | "node": ">= 6" 157 | } 158 | }, 159 | "node_modules/html-encoding-sniffer": { 160 | "version": "4.0.0", 161 | "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", 162 | "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", 163 | "license": "MIT", 164 | "dependencies": { 165 | "whatwg-encoding": "^3.1.1" 166 | }, 167 | "engines": { 168 | "node": ">=18" 169 | } 170 | }, 171 | "node_modules/http-proxy-agent": { 172 | "version": "7.0.2", 173 | "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", 174 | "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", 175 | "license": "MIT", 176 | "dependencies": { 177 | "agent-base": "^7.1.0", 178 | "debug": "^4.3.4" 179 | }, 180 | "engines": { 181 | "node": ">= 14" 182 | } 183 | }, 184 | "node_modules/https-proxy-agent": { 185 | "version": "7.0.4", 186 | "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", 187 | "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", 188 | "license": "MIT", 189 | "dependencies": { 190 | "agent-base": "^7.0.2", 191 | "debug": "4" 192 | }, 193 | "engines": { 194 | "node": ">= 14" 195 | } 196 | }, 197 | "node_modules/iconv-lite": { 198 | "version": "0.6.3", 199 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", 200 | "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", 201 | "license": "MIT", 202 | "dependencies": { 203 | "safer-buffer": ">= 2.1.2 < 3.0.0" 204 | }, 205 | "engines": { 206 | "node": ">=0.10.0" 207 | } 208 | }, 209 | "node_modules/is-potential-custom-element-name": { 210 | "version": "1.0.1", 211 | "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", 212 | "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" 213 | }, 214 | "node_modules/jsdom": { 215 | "version": "24.1.0", 216 | "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.1.0.tgz", 217 | "integrity": "sha512-6gpM7pRXCwIOKxX47cgOyvyQDN/Eh0f1MeKySBV2xGdKtqJBLj8P25eY3EVCWo2mglDDzozR2r2MW4T+JiNUZA==", 218 | "license": "MIT", 219 | "dependencies": { 220 | "cssstyle": "^4.0.1", 221 | "data-urls": "^5.0.0", 222 | "decimal.js": "^10.4.3", 223 | "form-data": "^4.0.0", 224 | "html-encoding-sniffer": "^4.0.0", 225 | "http-proxy-agent": "^7.0.2", 226 | "https-proxy-agent": "^7.0.4", 227 | "is-potential-custom-element-name": "^1.0.1", 228 | "nwsapi": "^2.2.10", 229 | "parse5": "^7.1.2", 230 | "rrweb-cssom": "^0.7.0", 231 | "saxes": "^6.0.0", 232 | "symbol-tree": "^3.2.4", 233 | "tough-cookie": "^4.1.4", 234 | "w3c-xmlserializer": "^5.0.0", 235 | "webidl-conversions": "^7.0.0", 236 | "whatwg-encoding": "^3.1.1", 237 | "whatwg-mimetype": "^4.0.0", 238 | "whatwg-url": "^14.0.0", 239 | "ws": "^8.17.0", 240 | "xml-name-validator": "^5.0.0" 241 | }, 242 | "engines": { 243 | "node": ">=18" 244 | }, 245 | "peerDependencies": { 246 | "canvas": "^2.11.2" 247 | }, 248 | "peerDependenciesMeta": { 249 | "canvas": { 250 | "optional": true 251 | } 252 | } 253 | }, 254 | "node_modules/mime-db": { 255 | "version": "1.52.0", 256 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 257 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 258 | "engines": { 259 | "node": ">= 0.6" 260 | } 261 | }, 262 | "node_modules/mime-types": { 263 | "version": "2.1.35", 264 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 265 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 266 | "dependencies": { 267 | "mime-db": "1.52.0" 268 | }, 269 | "engines": { 270 | "node": ">= 0.6" 271 | } 272 | }, 273 | "node_modules/ms": { 274 | "version": "2.1.2", 275 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 276 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 277 | "license": "MIT" 278 | }, 279 | "node_modules/nwsapi": { 280 | "version": "2.2.10", 281 | "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.10.tgz", 282 | "integrity": "sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ==" 283 | }, 284 | "node_modules/parse5": { 285 | "version": "7.1.2", 286 | "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", 287 | "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", 288 | "license": "MIT", 289 | "dependencies": { 290 | "entities": "^4.4.0" 291 | }, 292 | "funding": { 293 | "url": "https://github.com/inikulin/parse5?sponsor=1" 294 | } 295 | }, 296 | "node_modules/psl": { 297 | "version": "1.9.0", 298 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", 299 | "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" 300 | }, 301 | "node_modules/punycode": { 302 | "version": "2.3.1", 303 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", 304 | "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", 305 | "engines": { 306 | "node": ">=6" 307 | } 308 | }, 309 | "node_modules/querystringify": { 310 | "version": "2.2.0", 311 | "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", 312 | "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" 313 | }, 314 | "node_modules/requires-port": { 315 | "version": "1.0.0", 316 | "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", 317 | "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" 318 | }, 319 | "node_modules/rrweb-cssom": { 320 | "version": "0.7.1", 321 | "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", 322 | "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==", 323 | "license": "MIT" 324 | }, 325 | "node_modules/safer-buffer": { 326 | "version": "2.1.2", 327 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 328 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", 329 | "license": "MIT" 330 | }, 331 | "node_modules/saxes": { 332 | "version": "6.0.0", 333 | "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", 334 | "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", 335 | "license": "ISC", 336 | "dependencies": { 337 | "xmlchars": "^2.2.0" 338 | }, 339 | "engines": { 340 | "node": ">=v12.22.7" 341 | } 342 | }, 343 | "node_modules/symbol-tree": { 344 | "version": "3.2.4", 345 | "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", 346 | "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" 347 | }, 348 | "node_modules/tough-cookie": { 349 | "version": "4.1.4", 350 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", 351 | "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", 352 | "dependencies": { 353 | "psl": "^1.1.33", 354 | "punycode": "^2.1.1", 355 | "universalify": "^0.2.0", 356 | "url-parse": "^1.5.3" 357 | }, 358 | "engines": { 359 | "node": ">=6" 360 | } 361 | }, 362 | "node_modules/tr46": { 363 | "version": "5.0.0", 364 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", 365 | "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", 366 | "license": "MIT", 367 | "dependencies": { 368 | "punycode": "^2.3.1" 369 | }, 370 | "engines": { 371 | "node": ">=18" 372 | } 373 | }, 374 | "node_modules/universalify": { 375 | "version": "0.2.0", 376 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", 377 | "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", 378 | "engines": { 379 | "node": ">= 4.0.0" 380 | } 381 | }, 382 | "node_modules/url-parse": { 383 | "version": "1.5.10", 384 | "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", 385 | "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", 386 | "dependencies": { 387 | "querystringify": "^2.1.1", 388 | "requires-port": "^1.0.0" 389 | } 390 | }, 391 | "node_modules/w3c-xmlserializer": { 392 | "version": "5.0.0", 393 | "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", 394 | "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", 395 | "license": "MIT", 396 | "dependencies": { 397 | "xml-name-validator": "^5.0.0" 398 | }, 399 | "engines": { 400 | "node": ">=18" 401 | } 402 | }, 403 | "node_modules/webidl-conversions": { 404 | "version": "7.0.0", 405 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", 406 | "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", 407 | "license": "BSD-2-Clause", 408 | "engines": { 409 | "node": ">=12" 410 | } 411 | }, 412 | "node_modules/whatwg-encoding": { 413 | "version": "3.1.1", 414 | "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", 415 | "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", 416 | "license": "MIT", 417 | "dependencies": { 418 | "iconv-lite": "0.6.3" 419 | }, 420 | "engines": { 421 | "node": ">=18" 422 | } 423 | }, 424 | "node_modules/whatwg-mimetype": { 425 | "version": "4.0.0", 426 | "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", 427 | "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", 428 | "license": "MIT", 429 | "engines": { 430 | "node": ">=18" 431 | } 432 | }, 433 | "node_modules/whatwg-url": { 434 | "version": "14.0.0", 435 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.0.0.tgz", 436 | "integrity": "sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==", 437 | "license": "MIT", 438 | "dependencies": { 439 | "tr46": "^5.0.0", 440 | "webidl-conversions": "^7.0.0" 441 | }, 442 | "engines": { 443 | "node": ">=18" 444 | } 445 | }, 446 | "node_modules/ws": { 447 | "version": "8.17.1", 448 | "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", 449 | "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", 450 | "engines": { 451 | "node": ">=10.0.0" 452 | }, 453 | "peerDependencies": { 454 | "bufferutil": "^4.0.1", 455 | "utf-8-validate": ">=5.0.2" 456 | }, 457 | "peerDependenciesMeta": { 458 | "bufferutil": { 459 | "optional": true 460 | }, 461 | "utf-8-validate": { 462 | "optional": true 463 | } 464 | } 465 | }, 466 | "node_modules/xml-name-validator": { 467 | "version": "5.0.0", 468 | "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", 469 | "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", 470 | "license": "Apache-2.0", 471 | "engines": { 472 | "node": ">=18" 473 | } 474 | }, 475 | "node_modules/xmlchars": { 476 | "version": "2.2.0", 477 | "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", 478 | "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", 479 | "license": "MIT" 480 | } 481 | } 482 | } 483 | -------------------------------------------------------------------------------- /itest/jsdom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/itest-jsdom", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "JSON->URL jsdom-based integration test", 6 | "main": "main.js", 7 | "scripts": { 8 | "build": "", 9 | "test": "node ./" 10 | }, 11 | "author": "David MacCormack", 12 | "license": "MIT", 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/jsonurl/jsonurl-js.git" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/jsonurl/jsonurl-js/issues" 19 | }, 20 | "homepage": "https://www.jsonurl.org/", 21 | "dependencies": { 22 | "@jsonurl/jsonurl": "file:../..", 23 | "jsdom": "^24.1.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 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 | 25 | "use strict"; 26 | 27 | module.exports = { 28 | collectCoverage: true, 29 | }; 30 | -------------------------------------------------------------------------------- /jsdoc.config.js: -------------------------------------------------------------------------------- 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 | 25 | "use strict"; 26 | 27 | module.exports = { 28 | source: { 29 | include: ["README.md", "package.json", "src"], 30 | includePattern: ".+\\.(js|md)$", 31 | excludePattern: ".test.js$", 32 | }, 33 | sourceType: "module", 34 | opts: { 35 | destination: "./apidoc", 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /jsonurl.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * GetMissingValue function signature 4 | */ 5 | type GetMissingValue = { 6 | (key: string): any; 7 | }; 8 | 9 | /** 10 | * Options for the JsonURL.stringify function. 11 | * 12 | * @see https://github.com/jsonurl/specification#291-implied-arrays 13 | * @see https://github.com/jsonurl/specification#292-implied-objects 14 | * @see https://github.com/jsonurl/specification#293-x-www-form-urlencoded-arrays-and-objects 15 | * @see https://github.com/jsonurl/specification#295-empty-objects-and-arrays 16 | * @see https://github.com/jsonurl/specification#296-address-bar-query-string-friendly 17 | */ 18 | type JsonURLStringifyOptions = { 19 | /** 20 | * @type {boolean} [allowEmptyUnquotedKeys] Normally an empty string 21 | * value is represented as `''` (two single quotes). If this 22 | * is true the stringifier will omit a value rather than writing an 23 | * empty string. 24 | */ 25 | allowEmptyUnquotedValues?: boolean, 26 | /** 27 | * @type {boolean} [allowEmptyUnquotedKeys] Normally a key whose value is 28 | * the empty string is represented as `''` (two single quotes). If this 29 | * is true the stringifier will omit a value rather than writing an 30 | * empty string. 31 | */ 32 | allowEmptyUnquotedKeys?: boolean, 33 | /** 34 | * @type {boolean} [AQF] Enable the address bar query string friendly 35 | * (AQF) syntax option, and emit a string as oulined in section 36 | * 2.9.6 of the JSON→URL specification. 37 | */ 38 | AQF?: boolean, 39 | /** 40 | * @type {boolean} [coerceNullToEmptyString] Normally the stringifier will 41 | * emit a `null` value as a literal `null`. If this is true `null` 42 | * values will be coerced to the empty string. 43 | */ 44 | coerceNullToEmptyString?: boolean, 45 | /** 46 | * @type {Array} [impliedArray] Emit an implied array 47 | * as oulined in section 2.9.1 of the JSON→URL specification. 48 | */ 49 | impliedArray?: boolean, 50 | /** 51 | * @type {Object} [impliedObject] Emit an implied object 52 | * as oulined in section 2.9.1 of the JSON→URL specification. 53 | */ 54 | impliedObject?: boolean, 55 | /** 56 | * @type {boolean} [impliedStringLiterals] If true the stringifier will 57 | * emit JSON→URL text that assumes all literals are 58 | * strings. 59 | */ 60 | impliedStringLiterals?: boolean, 61 | /** 62 | * @type {boolean} [noEmptyComposite] Emit JSON→URL text as 63 | * oulined in section 2.9.4 of the JSON→URL specification. 64 | */ 65 | noEmptyComposite?: boolean, 66 | /** 67 | * @type {boolean} [wwwFormUrlEncoded] Emit x-www-form-urlencoded content 68 | * as oulined in section 2.9.3 of the JSON→URL specification. 69 | */ 70 | wwwFormUrlEncoded?: boolean, 71 | /** 72 | * @type {boolean} [callFunctions] The stringifier will inspect each 73 | * value to see if it's a function. 74 | * If `callFunctions` is true then functions will be called to resolve 75 | * the value; otherwise, they will be omitted. 76 | */ 77 | callFunctions?: boolean, 78 | /** 79 | * @deprecated 80 | * @type {boolean} [isImplied] Emit an implied object or array. For 81 | * consistency with parse() use `impliedArray` or `impliedObject`. 82 | */ 83 | isImplied?: boolean, 84 | /** 85 | * @type {boolean} [ignoreNullArrayMembers=false] Ignore null array members. 86 | * This is `true` by default if impliedStringLiterals is true, 87 | * and `false` by default otherwise. 88 | */ 89 | ignoreNullArrayMembers?: boolean, 90 | /** 91 | * @type {boolean} [ignoreNullObjectMembers=false] Ignore null object 92 | * members. This is `true` by default if impliedStringLiterals is true, 93 | * and `false` by default otherwise. 94 | */ 95 | ignoreNullObjectMembers?: boolean, 96 | /** 97 | * @type {boolean} [ignoreUndefinedArrayMembers] Ignore undefined array 98 | * members. This is `true` by default if impliedStringLiterals is true, 99 | * and `false` by default otherwise. Undefined values will be stringified 100 | * as `null` because `undefined` is not a valid JSON value. 101 | */ 102 | ignoreUndefinedArrayMembers?: boolean, 103 | /** 104 | * @type {boolean} [ignoreUndefinedObjectMembers] Ignore undefined object 105 | * members. This is `true` by default if impliedStringLiterals is true, 106 | * and `false` by default otherwise. Undefined values will be stringified 107 | * as `null` because `undefined` is not a valid JSON value. 108 | */ 109 | ignoreUndefinedObjectMembers?: boolean, 110 | } 111 | 112 | /** 113 | * Options for the JsonURL.parse function. 114 | * 115 | * @see https://github.com/jsonurl/specification#291-implied-arrays 116 | * @see https://github.com/jsonurl/specification#292-implied-objects 117 | * @see https://github.com/jsonurl/specification#293-x-www-form-urlencoded-arrays-and-objects 118 | * @see https://github.com/jsonurl/specification#294-implied-object-missing-values 119 | * @see https://github.com/jsonurl/specification#295-empty-objects-and-arrays 120 | * @see https://github.com/jsonurl/specification#296-address-bar-query-string-friendly 121 | */ 122 | type JsonURLParseOptions = { 123 | /** 124 | * @type {boolean} [allowEmptyUnquotedValues] Normally the empty string 125 | * is represented as `''` (two single quotes). This option allows the 126 | * parser to recognize an omitted value as the empty string. Note, in the 127 | * case of an object value the separator is still required. 128 | */ 129 | allowEmptyUnquotedValues?: boolean, 130 | /** 131 | * @type {boolean} [allowEmptyUnquotedKeys] Normally the empty string 132 | * is represented as `''` (two single quotes). This option allows the 133 | * parser to recognize an omitted object key as the empty string. Note, 134 | * the separator is still required. 135 | */ 136 | allowEmptyUnquotedKeys?: boolean, 137 | /** 138 | * @type {boolean} [AQF] Enable the address bar query string friendly 139 | * (AQF) syntax option, and implement the grammar oulined in section 140 | * 2.9.6 of the JSON→URL specification. 141 | */ 142 | AQF?: boolean, 143 | /** 144 | * @type {boolean} [coerceNullToEmptyString] Normally the `null` literal 145 | * is parsed as a JavaScript `null` value, however, if this is true 146 | * then `null` literals will be coerced to the empty string. 147 | */ 148 | coerceNullToEmptyString?: boolean, 149 | /** 150 | * @type {Array} [impliedArray] An implied array. 151 | * 152 | * If provied, parse will implement a parser for the grammar oulined in 153 | * section 2.9.1 of the JSON→URL specification. The given parse 154 | * text is assumed to be an array, and the leading and trailing parens 155 | * must not be present. The given array value will be populated and 156 | * returned. 157 | */ 158 | impliedArray?: Array, 159 | /** 160 | * @type {Object} [impliedObject] An implied object. 161 | * 162 | * If provided, parse will implement the grammar oulined in section 2.9.2 163 | * of the JSON→URL specification. The given parse text is assumed 164 | * to be an object, and the leading and trailing parens must not be 165 | * present. The given object value will be populated and returned. 166 | */ 167 | impliedObject?: object, 168 | /** 169 | * @type {boolean} [impliedStringLiterals] Instruct the parser to assume 170 | * that all literals are strings. In this case, the single quote character 171 | * loses its significance and is parsed as-is. 172 | */ 173 | impliedStringLiterals?: boolean, 174 | /** 175 | * @type {boolean} [noEmptyComposite] Implement the grammar 176 | * oulined in section 2.9.4 of the JSON→URL specification. 177 | * 178 | * If true, the parser will distinguish between empty array and empty 179 | * object. Empty array is back-to-back parens, e.g. `()`. Empty object 180 | * is two parens with a single colon inside, e.g. `(:)`. Note that this 181 | * prevents the parser from recognizing `(:)` as an object with a single 182 | * member whose key and value is the unquoted empty string when 183 | * `allowEmptyUnquotedValues` and `allowEmptyUnquotedValues` are also 184 | * both true. 185 | */ 186 | noEmptyComposite?: boolean, 187 | /** 188 | * @type {boolean} [wwwFormUrlEncoded] Implement the grammar oulined in 189 | * section 2.9.3 of the JSON→URL specification. 190 | * 191 | * The given parse text is may use ampersand and equal characters as the 192 | * value and member separator characters, respetively, at the top-level. 193 | * This may be combined with `impliedArray` or `impliedObject`. 194 | */ 195 | wwwFormUrlEncoded?: boolean, 196 | /** 197 | * @param {*} [emptyValue] The value which represents the empty composite. 198 | * This may be any type. If it is a function then it will be called 199 | * until it resolves to something that is not a function. The default 200 | * is an empty Object. 201 | */ 202 | emptyValue?: any, 203 | /** 204 | * @type {function} [getMissingValue] Implement the grammar oulined in 205 | * section 2.9.4 of the JSON→URL specification. 206 | * 207 | * This function provides a missing top-level value for the given key. 208 | */ 209 | getMissingValue?: GetMissingValue, 210 | /** 211 | * @type {*} [nullValue=null] The value which represents the `null` value. 212 | * This may be any type. If it is a function then it will be called 213 | * until it resolves to something that is not a function. The default 214 | * is `null`. 215 | */ 216 | nullValue?: any, 217 | /** 218 | * @type {number} [maxParseChars=65535] Maximum number of characters to 219 | * parse. The parse() method will throw an Error if it parses more than 220 | * this number of characters. The default is 64K. 221 | */ 222 | maxParseChars?: number, 223 | /** 224 | * @type {number} [maxParseDepth=64] Maximum parse depth. 225 | * The parse() method will throw an Error if the depth 226 | * of the input exceeds this value. The default is 64. 227 | */ 228 | maxParseDepth?: number, 229 | /** 230 | * @type {number} [maxParseValues=4096] Maximum number of values to parse. 231 | * The parse() method will throw an Error if it parses more than this 232 | * number of values. The default is 4096. 233 | */ 234 | maxParseValues?: number, 235 | /** 236 | * @type {boolean} [ignoreNullArrayMembers=false] Ignore null array 237 | * members. 238 | */ 239 | ignoreNullArrayMembers?: boolean, 240 | /** 241 | * @type {boolean} [ignoreNullObjectMembers=false] Ignore null object 242 | * members. 243 | */ 244 | ignoreNullObjectMembers?: boolean, 245 | } 246 | 247 | declare class JsonURL { 248 | /** 249 | * Construct a new JsonURL class. 250 | * 251 | * Each instance of this class contains a number of properties that manage 252 | * the behavior of the parser and the values it returns; these are documented 253 | * below. The class instance does not manage parse state -- that is local to 254 | * the parse() function itself. As long as you don't need different 255 | * properties (e.g. limits, null value, etc) you may re-use the same Parser 256 | * instance, even by multiple Workers. 257 | * @param {Object} [prop] Initialization properties. 258 | * @deprecated this constructior will be removed and the JsonURL class 259 | * will simply have two static functions (mirroring the interface 260 | * of the JSON Object). These properties may be sent as options to 261 | * parse() and stringify(). 262 | */ 263 | constructor(prop?: { 264 | /** 265 | * @type {number} [maxParseDepth=64] Maximum parse depth. 266 | * The parse() method will throw an Error if the depth 267 | * of the input exceeds this value. The default is 64. 268 | */ 269 | maxParseDepth?: number; 270 | /** 271 | * @type {number} [maxParseValues=4096] Maximum number of values to parse. 272 | * The parse() method will throw an Error if it parses more than this 273 | * number of values. The default is 4K. 274 | */ 275 | maxParseValues?: number; 276 | /** 277 | * @type {number} [maxParseChars=65535] Maximum number of characters to 278 | * parse. The parse() method will throw an Error if it parses more than 279 | * this number of characters. The default is 64K. 280 | */ 281 | maxParseChars?: number; 282 | /** 283 | * @param {*} [emptyValue] The value which represents the empty composite. 284 | * This may be any type. If it is a function then it will be called 285 | * until it resolves to something that is not a function. The default 286 | * is an empty Object. 287 | */ 288 | emptyValue?: any; 289 | /** 290 | * @type {*} [nullValue=null] The value which represents the `null` value. 291 | * This may be any type. If it is a function then it will be called 292 | * until it resolves to something that is not a function. The default 293 | * is `null`. 294 | */ 295 | nullValue?: any; 296 | }); 297 | 298 | /** 299 | * Parse JSON→URL text and return a JavaScript value. 300 | * 301 | * The `text` parameter must be provided. The second parameter may be 302 | * either the index into `text` where the parse should start (a number) 303 | * or parse options. If an offset is provided then the third parameter 304 | * may be either the index into `text` where the parse should end (a 305 | * number) or parse options. If the an end index is provided then the 306 | * forth parameter may be parse options. 307 | * 308 | * @public 309 | * @param {string} text The text to parse. 310 | * @param {number|JsonURLParseOptions} [startOrOpt] index into `text` 311 | * where parse should start (a number) or parse options. 312 | * @param {number|JsonURLParseOptions} [endOrOpt] index into `text` 313 | * where parse should end (a number) or parse options. 314 | * @param {JsonURLParseOptions} [options] parse options. 315 | * @return {any} the parsed value 316 | * @throws SyntaxError if there is a syntax error in the given text 317 | * @throws Error if a limit given in the constructor (or its default) 318 | * is exceeded. 319 | */ 320 | static parse(text: string, startOrOpt?: number | JsonURLParseOptions, endOrOpt?: number | JsonURLParseOptions, options?: JsonURLParseOptions): any; 321 | 322 | /** 323 | * Parse JSON→URL text and return a JavaScript value. 324 | * 325 | * The `text` parameter must be provided. The second parameter may be 326 | * either the index into `text` where the parse should start (a number) 327 | * or parse options. If an offset is provided then the third parameter 328 | * may be either the index into `text` where the parse should end (a 329 | * number) or parse options. If the an end index is provided then the 330 | * forth parameter may be parse options. 331 | * 332 | * @param {string} text The text to parse. 333 | * @param {number|JsonURLParseOptions} [startOrOpt] index into `text` 334 | * where parse should start (a number) or parse options. 335 | * @param {number|JsonURLParseOptions} [endOrOpt] index into `text` 336 | * where parse should end (a number) or parse options. 337 | * @param {JsonURLParseOptions} [options] parse options. 338 | * @return {any} the parsed value 339 | * @throws SyntaxError if there is a syntax error in the given text 340 | * @throws Error if a limit given in the constructor (or its default) 341 | * is exceeded. 342 | * @deprecated this function will be removed and the JsonURL class 343 | * will simply have two static functions (mirroring the interface 344 | * of the JSON Object). Call `JsonURL.parse()` instead. 345 | */ 346 | parse(text: string, startOrOpt?: number | JsonURLParseOptions, endOrOpt?: number | JsonURLParseOptions, options?: JsonURLParseOptions): any; 347 | 348 | /** 349 | * A static method for coverting a JavaScript value to JSON→URL text. 350 | * @public 351 | * @param {*} value Any value 352 | * @param {JsonURLStringifyOptions} [options] stringify options. 353 | * @returns {string} JSON→URL text, or `undefined` if the given value 354 | * is `undefined`. 355 | */ 356 | static stringify(value: any, options?: JsonURLStringifyOptions): string | undefined; 357 | } 358 | 359 | export default JsonURL; 360 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jsonurl/jsonurl", 3 | "version": "1.0.0-SNAPSHOT", 4 | "publishConfig": { 5 | "access": "public" 6 | }, 7 | "description": "JSON->URL defines a text format for the JSON data model suitable for use within a URL/URI (as described by RFC3986).", 8 | "main": "dist/jsonurl.common.js", 9 | "browser": "dist/jsonurl.min.js", 10 | "moduleName": "JsonURL", 11 | "types": "./jsonurl.d.ts", 12 | "scripts": { 13 | "build": "rollup -c", 14 | "test": "jest", 15 | "lint": "./script/lint.sh", 16 | "jsdoc": "jsdoc -c jsdoc.config.js -a public" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/jsonurl/jsonurl-js.git" 21 | }, 22 | "keywords": [ 23 | "JSON->URL", 24 | "json", 25 | "url", 26 | "uri" 27 | ], 28 | "author": "David MacCormack", 29 | "license": "MIT", 30 | "bugs": { 31 | "url": "https://github.com/jsonurl/jsonurl-js/issues" 32 | }, 33 | "homepage": "https://www.jsonurl.org/", 34 | "devDependencies": { 35 | "@babel/cli": "^7.15.4", 36 | "@babel/core": "^7.15.5", 37 | "@babel/eslint-parser": "^7.24.7", 38 | "@babel/plugin-syntax-import-assertions": "^7.24.7", 39 | "@babel/preset-env": "^7.15.4", 40 | "@rollup/plugin-alias": "^5.0.0", 41 | "@rollup/plugin-babel": "^6.0.0", 42 | "@rollup/plugin-eslint": "^9", 43 | "@rollup/plugin-replace": "^5.0.0", 44 | "@rollup/plugin-terser": "^0.4", 45 | "babel-jest": "^29.2.0", 46 | "editorconfig": "^2.0.0", 47 | "eslint": "^9", 48 | "eslint-config-prettier": "^9.1.0", 49 | "eslint-plugin-jest": "^28.6.0", 50 | "eslint-plugin-prettier": "^5.1.3", 51 | "jest": "^29.2.0", 52 | "jsdoc": "^4.0.0", 53 | "prettier": "^3.3.2", 54 | "rollup": "^4", 55 | "typescript": "^5.3.3" 56 | }, 57 | "browserslist": "defaults", 58 | "files": [ 59 | "CODE_OF_CONDUCT.md", 60 | "CONTRIBUTING.md", 61 | "dist", 62 | "jsonurl.d.ts", 63 | "NEWS.md", 64 | "SECURITY.md" 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /rollup.config.mjs: -------------------------------------------------------------------------------- 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 | 25 | import babel from "@rollup/plugin-babel"; 26 | import terser from "@rollup/plugin-terser"; 27 | import alias from "@rollup/plugin-alias"; 28 | import replace from "@rollup/plugin-replace"; 29 | import pkg from "./package.json" with { type: "json" }; 30 | 31 | const banner = 32 | "/*!\n" + 33 | ` * jsonurl.js v${pkg.version}\n` + 34 | ` * (c) ${new Date().getFullYear()} David MacCormack\n` + 35 | " * Released under the MIT License.\n" + 36 | " */"; 37 | 38 | // 39 | // https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers 40 | // 41 | const babelBundle = { 42 | babelHelpers: "bundled", 43 | }; 44 | const noprotoAlias = { 45 | entries: [{ find: "./proto.js", replacement: "./noproto.js" }], 46 | }; 47 | 48 | // 49 | // Efficienty tweak; call the function directly. 50 | // 51 | const toJsonURLText = { 52 | delimiters: ["", ""], 53 | include: "*/JsonURL.js", 54 | preventAssignment: true, 55 | values: { 56 | " toJsonURLText(e, ": " e.toJsonURLText(", 57 | " toJsonURLText(k, ": " k.toJsonURLText(", 58 | " toJsonURLText(v, ": " v.toJsonURLText(", 59 | " toJsonURLText(value, ": " value.toJsonURLText(", 60 | }, 61 | }; 62 | 63 | const config = [ 64 | { 65 | input: "src/index.js", 66 | output: [ 67 | { 68 | name: pkg.moduleName, 69 | file: "dist/jsonurl.js", 70 | format: "umd", 71 | }, 72 | ], 73 | plugins: [replace(toJsonURLText), babel(babelBundle)], 74 | }, 75 | { 76 | input: "src/index.js", 77 | output: [ 78 | { 79 | name: pkg.moduleName, 80 | file: pkg.browser, 81 | format: "umd", 82 | banner: banner, 83 | }, 84 | ], 85 | plugins: [replace(toJsonURLText), babel(babelBundle), terser()], 86 | }, 87 | // 88 | // this covers both ESM and CJS 89 | // https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1 90 | // 91 | { 92 | input: "src/index.js", 93 | output: [ 94 | { 95 | name: pkg.moduleName, 96 | file: pkg.main, 97 | format: "cjs", 98 | exports: "default", 99 | }, 100 | ], 101 | plugins: [replace(toJsonURLText), babel(babelBundle)], 102 | }, 103 | ]; 104 | 105 | // 106 | // create a `.noproto` version of each output 107 | // 108 | // debug with: console.dir(n, { depth: null }); 109 | // 110 | config.push.apply( 111 | config, 112 | config.map((src) => { 113 | const n = { 114 | input: src.input, 115 | output: src.output.map((e) => { 116 | const ret = Object.assign({}, e); 117 | ret.file = String(ret.file).replace(/\/jsonurl\./, "/jsonurl.noproto."); 118 | return ret; 119 | }), 120 | plugins: Object.assign([], src.plugins), 121 | }; 122 | n.plugins[1] = alias(noprotoAlias); 123 | return n; 124 | }) 125 | ); 126 | 127 | export default config; 128 | -------------------------------------------------------------------------------- /script/cdn_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | JSONURL_ORG_CLONE='https://github.com/jsonurl/jsonurl.github.io.git' 4 | SCRIPT_DIR=`dirname "$0"` 5 | VERSION_SH="$SCRIPT_DIR/version_snapshot.sh" 6 | 7 | git clone "$JSONURL_ORG_CLONE" dist 8 | test -x "$VERSION_SH" && "$VERSION_SH" 9 | npm run build 10 | cd ./dist 11 | 12 | sed -i -zre 's//