Skip to content

Releases: poppinss/utils

Fix typo in InvalidArgumentsException class name

02 Jan 11:36
Compare
Choose a tag to compare
  • fix: typo in InvalidArgumentsException class name 83cf216

v6.3.0-0...v6.3.1-0

Publish v6.2.0 under preview tag

30 Dec 09:25
Compare
Choose a tag to compare
Pre-release
v6.3.0-0

chore(release): 6.3.0-0

Add InvalidArgumentException class

30 Dec 09:07
Compare
Choose a tag to compare
  • docs(README): update source code size metrics 0272878
  • docs(README): fix badge url for github workflow 5ce09dd
  • refactor: remove unused ts-expects-error cd14897
  • feat: add InvalidArgumentExceptiom class 46e403a
  • chore: update dependencies 70964f7

Full Changelog: v5.0.0...v6.2.0

Add createError helper

15 Dec 09:36
Compare
Choose a tag to compare
Pre-release

Refer the README file to learn how the helper works.

Commits

  • feat: add "createError" helper method to create anonymous error classes ba2446e
  • chore: update dependencies 2c71123

v6.1.0-0...v6.2.0-0

Add RuntimeException class

29 Nov 12:32
Compare
Choose a tag to compare
Pre-release
  • feat: add RuntimeException class to throw runtime exceptions 2c431e4
  • chore: update dependencies e3bafb5
  • chore: update dependencies f8d1239

v6.0.1-0...v6.1.0-0

Export NormalizeConstructor and Constructor types

13 Nov 04:56
Compare
Choose a tag to compare
  • test: fix missing types issue within tests 2fab8ab
  • feat: export NormalizeConstructor and Constructor types 60b4333

Full Changelog: v6.0.0-3...v6.0.1-0

Improvements to the types of the ObjectBuilder

30 Oct 07:12
Compare
Choose a tag to compare
  • refactor: object builder to build the final type for the object c672620
  • chore: update dependencies fff3b25
  • ci: use reusable workflow e3a99e5
  • chore: update dependencies 2c005a2

Full Changelog: v6.0.0-2...v6.0.0-3

Make tsconfig strict and add coverage

22 Oct 10:18
Compare
Choose a tag to compare
Pre-release
  • style: turn on noImplicitAny 36fc36f
  • style: format source files 4838f9f
  • test: add tests for edge cases 17b144e
  • refactor: with tsconfig to be more strict 2707a2a
  • chore: update dependencies deda5f6
  • chore: update dependencies 095dbb2

v6.0.0-1...v6.0.0-2

Ergonomic improvements to default export and a method rename

05 Oct 06:51
Compare
Choose a tag to compare
  • Rename string.toSentence to string.sentence. Because, we do not use to prefix on any other helper, so let's have a uniform API.
  • In order for TypeScript LSP to suggest auto imports for export default, it needs the export to have a name. So we have given names to to string and json sub-modules default exports. You can learn more about the TypeScript LSP here microsoft/TypeScript#19877

Commits

  • refactor: rename "toSentence" method to "sentence" 95cb525
  • refactor: make string and json modules auto importable 2e86cae

v6.0.0-0...v6.0.0-1

Rewrite and ESM only

05 Oct 05:41
Compare
Choose a tag to compare
Rewrite and ESM only Pre-release
Pre-release

From the release title itself you can expect this package to have a lot of breaking changes. First in the form of being ESM only and another is in the form of restructuring, removing and refactoring existing helpers.

  • A lot of helpers are not needed anymore (they were for CJS mainly), some have been removed in favor of other utility packages.
  • Also, since we are now using Node sub-path exports, the external API for importing some of the sub-modules has been changed. Please refer to the README file to learn more about it.

Breaking changes

  • Remove esmRequire and esmResolver helper methods. It is not required since we are on native ES modules.

  • The defineStaticProperty property method arguments API has been changed.

    // Old API
    defineStaticProperty(
      self,
      BaseClass,
      options: { propertyName: string, defaultValue: any, strategy: string }
    )
    
    // New API
    defineStaticProperty(
      self,
      propertyName: string,
      options: { initialValue: any, strategy: string }
    )
  • Remove ManagerConfigValidator class. We will be using schema-based validation instead. AdonisJS packages used this class (we assume some third-party packages to be using them as well).

  • The Exception class API has been changed as well. Now, the Exception class allows for defining error message, code, and status when defining the exception.

    // Old API
    class UserNotFoundException extends Exception {
    }
    
    throw new UserNotFoundException('User not found', 404, 'E_USER_NOT_FOUND')
    
    // New API
    class UserNotFoundException extends Exception {
      static message = 'User not found'
      static status = 404
      static code = 'E_USER_NOT_FOUND'
    }
    
    throw new UserNotFoundException()
    
    // Changes to Constructor API
    throw new UserNotFoundException('User not found', { code: 'E_USER_NOT_FOUND', status: 404 })
    
    // Defining cause
    throw new UserNotFoundException('User not found', { cause: 'Database was down' })
  • The base64.decode and base64.urlDecode now raises an exception when the value of strict is set to true. It returned null in strict mode and corrupt value without strict mode.

  • The fsReadAll method API has been changed a little bit. Instead of accepting the filter callback as the 2nd argument, we now accept an options object, and the filter callback is a property on the options object.

    // Old API
    fsReadAll('./config', (filePath) => filePath.endsWith('.ts'))
    
    // New API
    fsReadAll('./config', {
      filter: (filePath) => filePath.endsWith('.ts')
    })
  • Remove requireAll in favor of fsImportAll. The newer helper uses the native ES modules import method and is async.

  • Remove resolveDir. This helper relied on require.resolve, which does not exist in ES modules.

  • Remove resolveFrom. Again, the helper relied on require.resolve.

  • Remove the types helper. We recommend you use the @sindresorhus/is package instead.

  • Remove the file helper. We recommend you directly use the @poppinss/file-generator package.

  • Remove the cuid helper. Use the cuid package directly.

String helpers breaking changes

  • Remove string.escapeHTML and string.encodeSymbols methods. These were wrappers over the he, and we recommend you use the package directly.
  • The string.defineIrregularRule, string.defineUncountableRule are accessible as string.pluralize.addIrregularRule and so on.
  • The string.pluralize and string.pluralize have been renamed to string.plural and string.singular. The pluralize method is a new function with different functionality (Refer to README).
  • The string.prettyBytes and string.toBytes methods have been renamed. You can access them as string.bytes.format and string.bytes.parse.
  • The string.prettyMs and string.toMs methods have been renamed. You can access them as string.milliseconds.format and string.milliseconds.parse.
  • The string.generateRandom method has been renamed string.random.
  • The string.toSlug method has been renamed to string.slug.

Commits

  • chore: ignore package-lock file 02612c7
  • chore: define types file for the lodash module f0a3ce3
  • test: replace EOL with \n, since exceptions are separated by unix new lines c980c80
  • test: debug statements to find failing tests cause on windows 4e15cdd
  • refactor: small improvements 718c058
  • test: do not run import ts files tests from compiled code 7623f43
  • refactor: massive changes, changelog will cover all 41ba986
  • refactor: re-organize all modules 8c21d97
  • refactor: move slugify to its own module d5c3ab4
  • refactor: move "truncate" and "exceprt" to their own respective modules ac2caca
  • refactor: remove string.titleCase in favor of changeCase.titleCase 745a3e3
  • refactor: pluralize module 099fdec
  • test: remove old tests for change case b150770
  • refactor: move casing helpers to "change_case" module 2df46c9
  • refactor: remove ManagerConfigValidator 8b211e3
  • refactor: exception class 504857e
  • refactor: remove "esmResolver" and "esmRequire" utilities 4c3e432
  • refactor: internal cleanup for the safe equal utility function ffd0fc5
  • refactor: few internal improvements to the object builder class 0ac7b59
  • refactor: remove "resolveFrom" and "resolveDir" utilities 1efc0e0
  • refactor: remove requireAll utility b10252c
  • style: update function description 078e6b6
  • refactor: small internal improvements to the message builder dacf85b
  • style: update license signature 610d746
  • refactor: use secure-json-parse in place of custom implementation b15e0c1
  • refactor: use safe-stable-stringify in place of custom implementation a79e770
  • chore: update meta files 264ba2a
  • refactor: interpolate function 812339f
  • chore: lowercase helpers dirname 1d4b35f
  • refactor: base64, fs_read_all and compose utilities ba2fa8c
  • chore(package): update dependencies e07af33

Full Changelog: v5.0.0...v6.0.0-0