@poppinss/utils 6.9.3 → 7.0.0-next.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.
Files changed (38) hide show
  1. package/README.md +204 -826
  2. package/build/index.d.ts +4 -24
  3. package/build/index.js +104 -233
  4. package/build/{src → modules}/base64.d.ts +2 -2
  5. package/build/modules/exception.d.ts +1 -0
  6. package/build/{src → modules/fs}/fs_import_all.d.ts +6 -1
  7. package/build/{src → modules/fs}/fs_read_all.d.ts +6 -1
  8. package/build/modules/fs/main.d.ts +2 -0
  9. package/build/modules/json/main.d.ts +2 -0
  10. package/build/{src → modules}/json/safe_parse.d.ts +1 -1
  11. package/build/{src → modules}/json/safe_stringify.d.ts +1 -1
  12. package/build/modules/string/string_builder.d.ts +2 -0
  13. package/build/modules/types.d.ts +1 -0
  14. package/build/src/compose.d.ts +12 -10
  15. package/build/src/define_static_property.d.ts +2 -4
  16. package/package.json +18 -18
  17. package/build/chunk-2KG3PWR4.js +0 -17
  18. package/build/chunk-4V5ON6P7.js +0 -7
  19. package/build/chunk-EJKUJ44Y.js +0 -12
  20. package/build/chunk-H54AK3PI.js +0 -7
  21. package/build/chunk-XHQBV7AF.js +0 -39
  22. package/build/src/assert.js +0 -33
  23. package/build/src/exception.d.ts +0 -1
  24. package/build/src/exception.js +0 -9
  25. package/build/src/exceptions/main.d.ts +0 -1
  26. package/build/src/exceptions/main.js +0 -9
  27. package/build/src/json/main.d.ts +0 -7
  28. package/build/src/json/main.js +0 -7
  29. package/build/src/object_builder.d.ts +0 -1
  30. package/build/src/slash.d.ts +0 -24
  31. package/build/src/slash.js +0 -7
  32. package/build/src/string/main.js +0 -8
  33. package/build/src/string/string_builder.d.ts +0 -3
  34. package/build/src/string/string_builder.js +0 -9
  35. package/build/src/types.d.ts +0 -35
  36. package/build/src/types.js +0 -0
  37. /package/build/{src → modules}/assert.d.ts +0 -0
  38. /package/build/{src → modules}/string/main.d.ts +0 -0
@@ -1,7 +0,0 @@
1
- // src/exceptions/main.ts
2
- import { InvalidArgumentsException, RuntimeException } from "@poppinss/exception";
3
-
4
- export {
5
- InvalidArgumentsException,
6
- RuntimeException
7
- };
@@ -1,12 +0,0 @@
1
- // src/slash.ts
2
- function slash(path) {
3
- const isExtendedLengthPath = path.startsWith("\\\\?\\");
4
- if (isExtendedLengthPath) {
5
- return path;
6
- }
7
- return path.replace(/\\/g, "/");
8
- }
9
-
10
- export {
11
- slash
12
- };
@@ -1,7 +0,0 @@
1
- // src/exception.ts
2
- import { Exception, createError } from "@poppinss/exception";
3
-
4
- export {
5
- Exception,
6
- createError
7
- };
@@ -1,39 +0,0 @@
1
- // src/json/safe_parse.ts
2
- import { parse } from "secure-json-parse";
3
- function safeParse(jsonString, reviver) {
4
- return parse(jsonString, reviver, {
5
- protoAction: "remove",
6
- constructorAction: "remove"
7
- });
8
- }
9
-
10
- // src/json/safe_stringify.ts
11
- import { configure } from "safe-stable-stringify";
12
- var stringify = configure({
13
- bigint: false,
14
- circularValue: void 0,
15
- deterministic: false
16
- });
17
- function jsonStringifyReplacer(replacer) {
18
- return function(key, value) {
19
- const val = replacer ? replacer.call(this, key, value) : value;
20
- if (typeof val === "bigint") {
21
- return val.toString();
22
- }
23
- return val;
24
- };
25
- }
26
- function safeStringify(value, replacer, space) {
27
- return stringify(value, jsonStringifyReplacer(replacer), space);
28
- }
29
-
30
- // src/json/main.ts
31
- var json = {
32
- safeParse,
33
- safeStringify
34
- };
35
- var main_default = json;
36
-
37
- export {
38
- main_default
39
- };
@@ -1,33 +0,0 @@
1
- import "../chunk-2KG3PWR4.js";
2
-
3
- // src/assert.ts
4
- import { inspect } from "node:util";
5
- import { AssertionError } from "node:assert";
6
- function assert(value, message) {
7
- return assertExists(value, message);
8
- }
9
- function assertExists(value, message) {
10
- if (!value) {
11
- throw new AssertionError({ message: message ?? "value is falsy" });
12
- }
13
- }
14
- function assertUnreachable(x) {
15
- throw new AssertionError({ message: `unreachable code executed: ${inspect(x)}` });
16
- }
17
- function assertNotNull(value, message) {
18
- if (value === null) {
19
- throw new AssertionError({ message: message ?? "unexpected null value" });
20
- }
21
- }
22
- function assertIsDefined(value, message) {
23
- if (value === void 0) {
24
- throw new AssertionError({ message: message ?? "unexpected undefined value" });
25
- }
26
- }
27
- export {
28
- assert,
29
- assertExists,
30
- assertIsDefined,
31
- assertNotNull,
32
- assertUnreachable
33
- };
@@ -1 +0,0 @@
1
- export { Exception, createError } from '@poppinss/exception';
@@ -1,9 +0,0 @@
1
- import {
2
- Exception,
3
- createError
4
- } from "../chunk-H54AK3PI.js";
5
- import "../chunk-2KG3PWR4.js";
6
- export {
7
- Exception,
8
- createError
9
- };
@@ -1 +0,0 @@
1
- export { InvalidArgumentsException, RuntimeException } from '@poppinss/exception';
@@ -1,9 +0,0 @@
1
- import {
2
- InvalidArgumentsException,
3
- RuntimeException
4
- } from "../../chunk-4V5ON6P7.js";
5
- import "../../chunk-2KG3PWR4.js";
6
- export {
7
- InvalidArgumentsException,
8
- RuntimeException
9
- };
@@ -1,7 +0,0 @@
1
- import { safeParse } from './safe_parse.js';
2
- import { safeStringify } from './safe_stringify.js';
3
- declare const json: {
4
- safeParse: typeof safeParse;
5
- safeStringify: typeof safeStringify;
6
- };
7
- export default json;
@@ -1,7 +0,0 @@
1
- import {
2
- main_default
3
- } from "../../chunk-XHQBV7AF.js";
4
- import "../../chunk-2KG3PWR4.js";
5
- export {
6
- main_default as default
7
- };
@@ -1 +0,0 @@
1
- export * from '@poppinss/object-builder';
@@ -1,24 +0,0 @@
1
- /**
2
- * Copy-pasted from https://github.com/sindresorhus/slash/blob/main/index.d.ts
3
- * @credit - https://github.com/sindresorhus/slash
4
- */
5
- /**
6
- * Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`.
7
- * [Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as
8
- * they're not extended-length paths.
9
- *
10
- * @example
11
- * ```
12
- * import path from 'node:path';
13
- * import slash from 'slash';
14
- *
15
- * const string = path.join('foo', 'bar');
16
- * // Unix => foo/bar
17
- * // Windows => foo\\bar
18
- *
19
- * slash(string);
20
- * // Unix => foo/bar
21
- * // Windows => foo/bar
22
- * ```
23
- */
24
- export declare function slash(path: string): string;
@@ -1,7 +0,0 @@
1
- import {
2
- slash
3
- } from "../chunk-EJKUJ44Y.js";
4
- import "../chunk-2KG3PWR4.js";
5
- export {
6
- slash
7
- };
@@ -1,8 +0,0 @@
1
- import "../../chunk-2KG3PWR4.js";
2
-
3
- // src/string/main.ts
4
- import string from "@poppinss/string";
5
- var main_default = string;
6
- export {
7
- main_default as default
8
- };
@@ -1,3 +0,0 @@
1
- import string from '@poppinss/string/builder';
2
- export * from '@poppinss/string/builder';
3
- export default string;
@@ -1,9 +0,0 @@
1
- import "../../chunk-2KG3PWR4.js";
2
-
3
- // src/string/string_builder.ts
4
- import string from "@poppinss/string/builder";
5
- export * from "@poppinss/string/builder";
6
- var string_builder_default = string;
7
- export {
8
- string_builder_default as default
9
- };
@@ -1,35 +0,0 @@
1
- type PickKeysByValue<T, V> = {
2
- [K in keyof T]: T[K] extends V ? K : never;
3
- }[keyof T];
4
- export type OmitProperties<T, P> = Omit<T, PickKeysByValue<T, P>>;
5
- type ScanFsBaseOptions = {
6
- ignoreMissingRoot?: boolean;
7
- filter?: (filePath: string, index: number) => boolean;
8
- sort?: (current: string, next: string) => number;
9
- };
10
- export type ImportAllFilesOptions = ScanFsBaseOptions & {
11
- /**
12
- * A custom method to transform collection keys
13
- */
14
- transformKeys?: (keys: string[]) => string[];
15
- };
16
- export type ReadAllFilesOptions = ScanFsBaseOptions & {
17
- pathType?: 'relative' | 'unixRelative' | 'absolute' | 'unixAbsolute' | 'url';
18
- };
19
- export type JSONReplacer = (this: any, key: string, value: any) => any;
20
- export type JSONReviver = (this: any, key: string, value: any) => any;
21
- export type Constructor = new (...args: any[]) => any;
22
- /**
23
- * Normalizes constructor to work with mixins. There is an open bug for mixins
24
- * to allow constructors other than `...args: any[]`
25
- *
26
- * https://github.com/microsoft/TypeScript/issues/37142
27
- */
28
- export type NormalizeConstructor<T extends Constructor> = {
29
- new (...args: any[]): InstanceType<T>;
30
- } & Omit<T, 'constructor'>;
31
- declare const opaqueProp: unique symbol;
32
- export type Opaque<T, K> = T & {
33
- [opaqueProp]: K;
34
- };
35
- export {};
File without changes
File without changes
File without changes