Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Enhance APIs with file URL path support #2

Merged
merged 6 commits into from
Apr 19, 2024

Commits on Apr 19, 2024

  1. feat: Add an internal function to convert file URL

    This function behave the same as NodeJS `url.fileURLToPath` function, but that makes this function differ is that this function supports relative paths being passed in the argument (e.g., "file:./foo/bar"). If the given URL is have non-file protocols or contains invalid path structures, an URIError will be thrown.
    
    This function will be used as part of `ls*` functions to support file URL paths. In addition to this change, I've also added the documentation for the function.
    mitsuki31 committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    2638e4f View commit details
    Browse the repository at this point in the history
  2. feat: Add file URL support for ls* functions

    Now all `ls*` functions have supported file URL path, this can be a string URL path or an URL object with 'file:' protocol.
    
    Note:
    Please note, that this function currently only supported 'file:' protocol to resolve and list the specified directory.
    mitsuki31 committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    871ab46 View commit details
    Browse the repository at this point in the history
  3. test(simpletest): Include several assert functions

    Included functions (from 'node:assert' module):
      - doesNotThrow: assert.doesNotThrow,
      - rejects: assert.rejects,
      - doesNotReject: assert.doesNotReject,
      - match: assert.match,
      - doesNotMatch: assert.doesNotMatch
    mitsuki31 committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    fbf739a View commit details
    Browse the repository at this point in the history
  4. refactor(ls): Fix absolute path resolver on Windows

    The path passed to `fs.readdir` function can't be a Windows path, instead it must a node path (i.e., similar to POSIX path). That's why we need to resolve the relative path to absolute with format of POSIX path, so the path can be used to the `fs.readdir` function without getting an internal error.
    mitsuki31 committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    d6c9107 View commit details
    Browse the repository at this point in the history
  5. docs: Update and improve the APIs documentation

    ALso added a history section to describe changes to the APIs in every versions.
    mitsuki31 committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    14daa9a View commit details
    Browse the repository at this point in the history
  6. test: Introduce new test cases

    Added new test cases to test the APIs whether it correctly accepts file URL path and a `URL` object with 'file:' protocol, and correctly throws an `URIError` if the provided URL path using unsupported protocols.
    mitsuki31 committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    6c3a254 View commit details
    Browse the repository at this point in the history