@poppinss/utils 6.5.0-7 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > A toolkit of utilities used across all the AdonisJS, Edge, and Japa packages
4
4
 
5
- [![gh-workflow-image]][gh-workflow-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url] [![synk-image]][synk-url]
5
+ [![gh-workflow-image]][gh-workflow-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
6
6
 
7
7
  ## Why this package exists?
8
8
 
@@ -1108,13 +1108,11 @@ const dirname = getDirname(import.meta.url)
1108
1108
  const filename = getFilename(import.meta.url)
1109
1109
  ```
1110
1110
 
1111
- [gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/poppinss/utils/test.yml?style=for-the-badge
1112
- [gh-workflow-url]: https://github.com/poppinss/utils/actions/workflows/test.yml 'Github action'
1111
+ [gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/poppinss/utils/checks.yml?style=for-the-badge
1112
+ [gh-workflow-url]: https://github.com/poppinss/utils/actions/workflows/checks.yml 'Github action'
1113
1113
  [typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
1114
1114
  [typescript-url]: "typescript"
1115
1115
  [npm-image]: https://img.shields.io/npm/v/@poppinss/utils.svg?style=for-the-badge&logo=npm
1116
1116
  [npm-url]: https://npmjs.org/package/@poppinss/utils 'npm'
1117
1117
  [license-image]: https://img.shields.io/npm/l/@poppinss/utils?color=blueviolet&style=for-the-badge
1118
1118
  [license-url]: LICENSE.md 'license'
1119
- [synk-image]: https://img.shields.io/snyk/vulnerabilities/github/poppinss/utils?label=Synk%20Vulnerabilities&style=for-the-badge
1120
- [synk-url]: https://snyk.io/test/github/poppinss/utils?targetFile=package.json 'synk'
@@ -0,0 +1,5 @@
1
+ declare function assert(value: unknown, message?: string): asserts value;
2
+ declare function assertUnreachable(x?: never): never;
3
+ declare function assertNotNull<T>(value: T | null): asserts value is Exclude<T, null>;
4
+
5
+ export { assert, assertNotNull, assertUnreachable };
@@ -0,0 +1,19 @@
1
+ // src/assert.ts
2
+ function assert(value, message) {
3
+ if (!value) {
4
+ throw new Error(message ?? "value is falsy");
5
+ }
6
+ }
7
+ function assertUnreachable(x) {
8
+ throw new Error(`unreachable code executed: ${String(x)}`);
9
+ }
10
+ function assertNotNull(value) {
11
+ if (value === null) {
12
+ throw new Error("unexpected null value");
13
+ }
14
+ }
15
+ export {
16
+ assert,
17
+ assertNotNull,
18
+ assertUnreachable
19
+ };
@@ -28,5 +28,8 @@ type Constructor = new (...args: any[]) => any;
28
28
  type NormalizeConstructor<T extends Constructor> = {
29
29
  new (...args: any[]): InstanceType<T>;
30
30
  } & Omit<T, 'constructor'>;
31
+ type Opaque<T, K> = T & {
32
+ [' __opaque__']: K;
33
+ };
31
34
 
32
- export { Constructor, ImportAllFilesOptions, JSONReplacer, JSONReviver, NormalizeConstructor, OmitProperties, ReadAllFilesOptions };
35
+ export { Constructor, ImportAllFilesOptions, JSONReplacer, JSONReviver, NormalizeConstructor, OmitProperties, Opaque, ReadAllFilesOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poppinss/utils",
3
- "version": "6.5.0-7",
3
+ "version": "6.5.0",
4
4
  "description": "Handy utilities for repetitive work",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -49,17 +49,17 @@
49
49
  "@adonisjs/eslint-config": "^1.1.6",
50
50
  "@adonisjs/prettier-config": "^1.1.6",
51
51
  "@adonisjs/tsconfig": "^1.1.6",
52
- "@commitlint/cli": "^17.6.6",
52
+ "@commitlint/cli": "^17.7.2",
53
53
  "@commitlint/config-conventional": "^17.6.6",
54
- "@japa/assert": "^2.0.0-1",
55
- "@japa/expect-type": "^2.0.0-0",
56
- "@japa/runner": "^3.0.0-2",
54
+ "@japa/assert": "^2.0.0",
55
+ "@japa/expect-type": "^2.0.0",
56
+ "@japa/runner": "^3.0.1",
57
57
  "@swc/core": "1.3.82",
58
58
  "@types/fs-extra": "^11.0.2",
59
- "@types/node": "^20.6.3",
59
+ "@types/node": "^20.8.6",
60
60
  "c8": "^8.0.0",
61
61
  "del-cli": "^5.1.0",
62
- "eslint": "^8.50.0",
62
+ "eslint": "^8.51.0",
63
63
  "fs-extra": "^11.1.1",
64
64
  "github-label-sync": "^2.3.1",
65
65
  "husky": "^8.0.3",
@@ -75,7 +75,7 @@
75
75
  "dependencies": {
76
76
  "@lukeed/ms": "^2.0.1",
77
77
  "@types/bytes": "^3.1.2",
78
- "@types/pluralize": "0.0.30",
78
+ "@types/pluralize": "^0.0.31",
79
79
  "bytes": "^3.1.2",
80
80
  "case-anything": "^2.1.13",
81
81
  "flattie": "^1.1.0",
@@ -112,11 +112,11 @@
112
112
  },
113
113
  "publishConfig": {
114
114
  "access": "public",
115
- "tag": "next"
115
+ "tag": "latest"
116
116
  },
117
117
  "np": {
118
118
  "message": "chore(release): %s",
119
- "tag": "next",
119
+ "tag": "latest",
120
120
  "branch": "main",
121
121
  "anyBranch": false
122
122
  },
@@ -127,6 +127,7 @@
127
127
  "tsup": {
128
128
  "entry": [
129
129
  "./index.ts",
130
+ "./src/assert.ts",
130
131
  "./src/string/main.ts",
131
132
  "./src/string_builder.ts",
132
133
  "./src/json/main.ts",