@bccampus/utils 0.1.1 → 0.2.1
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/dist/array/chunk.cjs +9 -0
- package/dist/array/index.cjs +4 -0
- package/dist/date/index.cjs +8 -0
- package/dist/date/iso-date-time.cjs +256 -0
- package/dist/duration/add-durations.cjs +12 -0
- package/dist/duration/index.cjs +8 -0
- package/dist/duration/is-duration.cjs +7 -0
- package/dist/duration/to-number.cjs +14 -0
- package/dist/format/formatter.cjs +40 -0
- package/dist/format/index.cjs +13 -0
- package/dist/format/stringify.cjs +42 -0
- package/dist/format/template.cjs +35 -0
- package/dist/object/get.cjs +7 -0
- package/dist/object/index.cjs +12 -0
- package/dist/object/is-object.cjs +4 -0
- package/dist/object/omit.cjs +18 -0
- package/dist/object/pick.cjs +11 -0
- package/dist/object/set.cjs +14 -0
- package/dist/path/file-url-to-path.cjs +10 -0
- package/dist/path/file-url-to-path.d.ts +4 -0
- package/dist/path/file-url-to-path.js +10 -0
- package/dist/path/index.cjs +6 -0
- package/dist/path/index.d.ts +2 -0
- package/dist/path/index.js +6 -0
- package/dist/path/normalize.cjs +32 -0
- package/dist/path/normalize.d.ts +31 -0
- package/dist/path/normalize.js +32 -0
- package/dist/set/difference.cjs +10 -0
- package/dist/set/index.cjs +12 -0
- package/dist/set/intersection.cjs +13 -0
- package/dist/set/is-superset.cjs +12 -0
- package/dist/set/symmetric-difference.cjs +14 -0
- package/dist/set/union.cjs +10 -0
- package/dist/string/capitalize.cjs +4 -0
- package/dist/string/index.cjs +14 -0
- package/dist/string/normalize.cjs +6 -0
- package/dist/string/normalize.d.ts +5 -0
- package/dist/string/normalize.js +6 -0
- package/dist/string/pluralize/index.cjs +6 -0
- package/dist/string/pluralize/pluralize.cjs +210 -0
- package/dist/string/pluralize/rules/index.cjs +10 -0
- package/dist/string/pluralize/rules/irregular.cjs +62 -0
- package/dist/string/pluralize/rules/pluralization.cjs +39 -0
- package/dist/string/pluralize/rules/singularization.cjs +47 -0
- package/dist/string/pluralize/rules/uncountable.cjs +113 -0
- package/dist/string/pluralize/types.cjs +1 -0
- package/dist/string/slugify/index.cjs +2263 -0
- package/dist/string/strip-html-tags.cjs +7 -0
- package/dist/string/to-int.cjs +10 -0
- package/dist/string/to-sentence-case.cjs +8 -0
- package/dist/string/trim.cjs +11 -0
- package/dist/string/truncate.cjs +20 -0
- package/dist/string/truncate.d.ts +22 -1
- package/dist/string/truncate.js +14 -3
- package/dist/value/index.cjs +4 -0
- package/dist/value/index.d.ts +1 -0
- package/dist/value/index.js +4 -0
- package/dist/value/is-empty.cjs +14 -0
- package/dist/value/is-empty.d.ts +17 -0
- package/dist/value/is-empty.js +14 -0
- package/package.json +29 -10
- package/src/format/index.ts +3 -3
- package/src/path/file-url-to-path.ts +12 -0
- package/src/path/index.ts +2 -0
- package/src/path/normalize.ts +72 -0
- package/src/string/normalize.ts +7 -0
- package/src/string/truncate.ts +44 -11
- package/src/value/index.ts +1 -0
- package/src/value/is-empty.ts +31 -0
- package/tsconfig.lib.json +36 -35
- package/vite.config.ts +75 -77
- package/tsconfig.lib.tsbuildinfo +0 -1
package/vite.config.ts
CHANGED
|
@@ -1,77 +1,75 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { globSync } from "tinyglobby";
|
|
4
|
-
import { defineConfig } from "vite";
|
|
5
|
-
import dts from "vite-plugin-dts";
|
|
6
|
-
import packageConfig from "./package.json";
|
|
7
|
-
import { writeFileSync } from "node:fs";
|
|
8
|
-
|
|
9
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const outDir = "./dist";
|
|
11
|
-
|
|
12
|
-
const createEntries = () => {
|
|
13
|
-
const entries = new Map<string, string>();
|
|
14
|
-
const exports = new Map<
|
|
15
|
-
string,
|
|
16
|
-
{
|
|
17
|
-
types: string;
|
|
18
|
-
import: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
});
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { globSync } from "tinyglobby";
|
|
4
|
+
import { defineConfig } from "vite";
|
|
5
|
+
import dts from "vite-plugin-dts";
|
|
6
|
+
import packageConfig from "./package.json";
|
|
7
|
+
import { writeFileSync } from "node:fs";
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const outDir = "./dist";
|
|
11
|
+
|
|
12
|
+
const createEntries = () => {
|
|
13
|
+
const entries = new Map<string, string>();
|
|
14
|
+
const exports = new Map<
|
|
15
|
+
string,
|
|
16
|
+
{
|
|
17
|
+
types: string;
|
|
18
|
+
import: string;
|
|
19
|
+
require: string;
|
|
20
|
+
}
|
|
21
|
+
>();
|
|
22
|
+
|
|
23
|
+
const files = globSync("src/**/*.ts", {
|
|
24
|
+
cwd: __dirname,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
const filePath = file.split(".")[0].replace(/^src[/\\]/, "");
|
|
29
|
+
|
|
30
|
+
if (!filePath) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const filePathParts = filePath.split("/");
|
|
35
|
+
if (filePathParts.at(-1) === "index" && filePathParts.length <= 3) {
|
|
36
|
+
const exportPath = filePathParts.length === 1 ? "." : `./${filePathParts.slice(0, -1).join("/")}`;
|
|
37
|
+
|
|
38
|
+
exports.set(exportPath, {
|
|
39
|
+
types: `${outDir}/${filePath}.d.ts`,
|
|
40
|
+
import: `${outDir}/${filePath}.js`,
|
|
41
|
+
require: `${outDir}/${filePath}.cjs`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
entries.set(filePath, fileURLToPath(new URL(file, import.meta.url)));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const _packageConfig = {
|
|
49
|
+
...packageConfig,
|
|
50
|
+
exports: Object.fromEntries(exports),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
writeFileSync("./package.json", JSON.stringify(_packageConfig, null, 2), {
|
|
54
|
+
encoding: "utf-8",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return Object.fromEntries(entries);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
plugins: [dts({ tsconfigPath: "./tsconfig.lib.json" })],
|
|
62
|
+
resolve: {
|
|
63
|
+
alias: {
|
|
64
|
+
"@": path.resolve(__dirname, "./src"),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
build: {
|
|
68
|
+
minify: false,
|
|
69
|
+
copyPublicDir: false,
|
|
70
|
+
lib: {
|
|
71
|
+
entry: createEntries(),
|
|
72
|
+
name: "utils",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
package/tsconfig.lib.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/array/chunk.ts","./src/array/index.ts","./src/date/index.ts","./src/date/iso-date-time.ts","./src/duration/add-durations.ts","./src/duration/index.ts","./src/duration/is-duration.ts","./src/duration/to-number.ts","./src/format/formatter.ts","./src/format/index.ts","./src/format/stringify.ts","./src/format/template.ts","./src/object/get.ts","./src/object/index.ts","./src/object/is-object.ts","./src/object/omit.ts","./src/object/pick.ts","./src/object/set.ts","./src/set/difference.ts","./src/set/index.ts","./src/set/intersection.ts","./src/set/is-superset.ts","./src/set/symmetric-difference.ts","./src/set/union.ts","./src/string/capitalize.ts","./src/string/index.ts","./src/string/strip-html-tags.ts","./src/string/to-int.ts","./src/string/to-sentence-case.ts","./src/string/trim.ts","./src/string/truncate.ts","./src/string/pluralize/index.ts","./src/string/pluralize/pluralize.ts","./src/string/pluralize/types.ts","./src/string/pluralize/rules/index.ts","./src/string/pluralize/rules/irregular.ts","./src/string/pluralize/rules/pluralization.ts","./src/string/pluralize/rules/singularization.ts","./src/string/pluralize/rules/uncountable.ts","./src/string/slugify/index.ts"],"version":"5.9.3"}
|