@bemedev/dev-utils 0.7.0 → 0.8.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.
Files changed (113) hide show
  1. package/lib/build-tests/addTarball.cjs.map +1 -1
  2. package/lib/build-tests/addTarball.js.map +1 -1
  3. package/lib/build-tests/buildPackageJson.cjs.map +1 -1
  4. package/lib/build-tests/buildPackageJson.js.map +1 -1
  5. package/lib/build-tests/cleanup.cjs.map +1 -1
  6. package/lib/build-tests/cleanup.js.map +1 -1
  7. package/lib/build-tests/cli/index.js +0 -0
  8. package/lib/build-tests/cli/test.cjs.map +1 -1
  9. package/lib/build-tests/cli/test.js.map +1 -1
  10. package/lib/build-tests/getRelativePath.cjs.map +1 -1
  11. package/lib/build-tests/getRelativePath.js.map +1 -1
  12. package/lib/build-tests/getTypescriptOutdir.cjs +10 -2
  13. package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
  14. package/lib/build-tests/getTypescriptOutdir.js +9 -2
  15. package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
  16. package/lib/build-tests/import.cjs.map +1 -1
  17. package/lib/build-tests/import.js.map +1 -1
  18. package/lib/build-tests/imports/create.cjs.map +1 -1
  19. package/lib/build-tests/imports/create.js.map +1 -1
  20. package/lib/build-tests/imports/helper.cjs.map +1 -1
  21. package/lib/build-tests/imports/helper.js.map +1 -1
  22. package/lib/build-tests/pack.cjs.map +1 -1
  23. package/lib/build-tests/pack.js.map +1 -1
  24. package/lib/rolldown-config/config.cjs +3 -3
  25. package/lib/rolldown-config/config.cjs.map +1 -1
  26. package/lib/rolldown-config/config.js +3 -3
  27. package/lib/rolldown-config/config.js.map +1 -1
  28. package/lib/rolldown-config/helpers.cjs.map +1 -1
  29. package/lib/rolldown-config/helpers.js.map +1 -1
  30. package/lib/rolldown-config/index.d.ts +1 -0
  31. package/lib/rolldown-config/input.cjs.map +1 -1
  32. package/lib/rolldown-config/input.js.map +1 -1
  33. package/lib/rolldown-config/output.cjs +2 -1
  34. package/lib/rolldown-config/output.cjs.map +1 -1
  35. package/lib/rolldown-config/output.d.ts +1 -1
  36. package/lib/rolldown-config/output.js +2 -1
  37. package/lib/rolldown-config/output.js.map +1 -1
  38. package/lib/rolldown-config/plugins/alias.cjs.map +1 -1
  39. package/lib/rolldown-config/plugins/alias.js.map +1 -1
  40. package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
  41. package/lib/rolldown-config/plugins/circulars.js.map +1 -1
  42. package/lib/rolldown-config/plugins/clean.cjs +10 -4
  43. package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
  44. package/lib/rolldown-config/plugins/clean.d.ts +1 -1
  45. package/lib/rolldown-config/plugins/clean.js +8 -3
  46. package/lib/rolldown-config/plugins/clean.js.map +1 -1
  47. package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
  48. package/lib/rolldown-config/plugins/externals.js.map +1 -1
  49. package/lib/rolldown-config/plugins/index.d.ts +2 -2
  50. package/lib/rolldown-config/plugins/tsPaths.cjs.map +1 -1
  51. package/lib/rolldown-config/plugins/tsPaths.js.map +1 -1
  52. package/lib/rolldown-config/plugins/typescript.cjs +4 -2
  53. package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
  54. package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
  55. package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
  56. package/lib/rolldown-config/plugins/typescript.d.ts +1 -1
  57. package/lib/rolldown-config/plugins/typescript.js +4 -2
  58. package/lib/rolldown-config/plugins/typescript.js.map +1 -1
  59. package/lib/rolldown-config/utils.cjs.map +1 -1
  60. package/lib/rolldown-config/utils.js.map +1 -1
  61. package/lib/utils/sleep.cjs.map +1 -1
  62. package/lib/utils/sleep.js.map +1 -1
  63. package/lib/vitest-exclude/vitest.cjs +39 -14
  64. package/lib/vitest-exclude/vitest.cjs.map +1 -1
  65. package/lib/vitest-exclude/vitest.d.ts +4 -3
  66. package/lib/vitest-exclude/vitest.js +39 -14
  67. package/lib/vitest-exclude/vitest.js.map +1 -1
  68. package/lib/vitest-exclude/vitest.utils.cjs +8 -8
  69. package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
  70. package/lib/vitest-exclude/vitest.utils.d.ts +4 -4
  71. package/lib/vitest-exclude/vitest.utils.js +8 -8
  72. package/lib/vitest-exclude/vitest.utils.js.map +1 -1
  73. package/lib/vitest-extended/acceptation.cjs.map +1 -1
  74. package/lib/vitest-extended/acceptation.js.map +1 -1
  75. package/lib/vitest-extended/createTests.cjs.map +1 -1
  76. package/lib/vitest-extended/createTests.js.map +1 -1
  77. package/lib/vitest-extended/done.cjs.map +1 -1
  78. package/lib/vitest-extended/done.js.map +1 -1
  79. package/lib/vitest-extended/each/error.cjs.map +1 -1
  80. package/lib/vitest-extended/each/error.js.map +1 -1
  81. package/lib/vitest-extended/each/pass.cjs.map +1 -1
  82. package/lib/vitest-extended/each/pass.js.map +1 -1
  83. package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
  84. package/lib/vitest-extended/fakeWaiter.js.map +1 -1
  85. package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
  86. package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
  87. package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
  88. package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
  89. package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
  90. package/lib/vitest-extended/fixtures/zod.js.map +1 -1
  91. package/lib/vitest-extended/identity.cjs.map +1 -1
  92. package/lib/vitest-extended/identity.js.map +1 -1
  93. package/lib/vitest-extended/index.d.ts +1 -0
  94. package/lib/vitest-extended/isDefined.cjs.map +1 -1
  95. package/lib/vitest-extended/isDefined.d.ts +1 -0
  96. package/lib/vitest-extended/isDefined.js.map +1 -1
  97. package/lib/vitest-extended/isFunction.cjs.map +1 -1
  98. package/lib/vitest-extended/isFunction.js.map +1 -1
  99. package/lib/vitest-extended/toArray.cjs.map +1 -1
  100. package/lib/vitest-extended/toArray.js.map +1 -1
  101. package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
  102. package/lib/vitest-extended/toStringFlat.js.map +1 -1
  103. package/lib/vitest-extended/types.d.ts +1 -1
  104. package/package.json +23 -67
  105. package/README.md +0 -696
  106. package/lib/vitest-alias/index.cjs +0 -4
  107. package/lib/vitest-alias/index.d.ts +0 -1
  108. package/lib/vitest-alias/index.js +0 -2
  109. package/lib/vitest-alias/vitest.cjs +0 -77
  110. package/lib/vitest-alias/vitest.cjs.map +0 -1
  111. package/lib/vitest-alias/vitest.d.ts +0 -38
  112. package/lib/vitest-alias/vitest.js +0 -74
  113. package/lib/vitest-alias/vitest.js.map +0 -1
@@ -1,77 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.cjs");
3
- let path = require("path");
4
- //#region src/vitest-alias/vitest.ts
5
- const configPaths = (arg) => {
6
- return arg.replace("/*", "");
7
- };
8
- const checkBaseUrl = (url) => {
9
- return url && url !== "." && url !== "./";
10
- };
11
- const transformer = (baseUrl) => {
12
- return ([_key, _value]) => {
13
- const key = configPaths(_key);
14
- const lastPath = configPaths(_value);
15
- const cwd = process.cwd();
16
- return [key, (0, path.resolve)(...checkBaseUrl(baseUrl) ? [
17
- cwd,
18
- baseUrl,
19
- lastPath
20
- ] : [cwd, lastPath])];
21
- };
22
- };
23
- /**
24
- * Add manually your alias with this function
25
- * @param tsconfig The tsconfig json
26
- * @returns a vitest config
27
- *
28
- * @example
29
- * <code>
30
- * {
31
- * test: {
32
- * alias: createAlias(tsconfig),
33
- * }
34
- * }
35
- *</code>
36
- */
37
- const createAlias = (tsconfig) => {
38
- const paths = tsconfig?.compilerOptions?.paths;
39
- if (!paths) return {};
40
- const array = Object.entries(paths).map(([key, [value]]) => {
41
- return [key, value];
42
- });
43
- const baseUrl = tsconfig?.compilerOptions?.baseUrl;
44
- const transformedArray = array.map(transformer(baseUrl));
45
- return Object.fromEntries(transformedArray);
46
- };
47
- /**
48
- * Plugin to add alias from tsconfig to test.alias
49
- *
50
- * @param tsconfig The tsconfig json
51
- * @returns a vitest config
52
- *
53
- * @remarks
54
- * Make sure you add "resolveJsonModule": true
55
- * inside your tsconfig.json at compilerOPtions
56
- * or add the json directly
57
- */
58
- const aliasTs = (tsconfig) => ({
59
- name: "aliasTs",
60
- enforce: "pre",
61
- config: (options) => {
62
- const testConfig = options?.test;
63
- const alias = createAlias(tsconfig);
64
- return {
65
- ...options,
66
- test: {
67
- ...testConfig,
68
- alias
69
- }
70
- };
71
- }
72
- });
73
- //#endregion
74
- exports.aliasTs = aliasTs;
75
- exports.createAlias = createAlias;
76
-
77
- //# sourceMappingURL=vitest.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.cjs","names":[],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport type { ViteUserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: TsConf) => {\n const paths = tsconfig?.compilerOptions?.paths;\n if (!paths) return {};\n const entries = Object.entries(paths);\n const array = entries.map(([key, [value]]) => {\n return [key, value];\n }) as Entry[];\n\n const baseUrl = tsconfig?.compilerOptions?.baseUrl;\n const transformedArray = array.map(transformer(baseUrl));\n const object = Object.fromEntries(transformedArray);\n\n return object;\n};\n\n/**\n * Plugin to add alias from tsconfig to test.alias\n *\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @remarks\n * Make sure you add \"resolveJsonModule\": true\n * inside your tsconfig.json at compilerOPtions\n * or add the json directly\n */\nexport const aliasTs = (tsconfig?: TsConf): Plugin => ({\n name: 'aliasTs',\n enforce: 'pre',\n config: options => {\n const testConfig = options?.test;\n const alias = createAlias(tsconfig);\n\n return {\n ...options,\n test: {\n ...testConfig,\n alias,\n },\n };\n },\n});\n"],"mappings":";;;;AAcA,MAAM,eAAe,QAAgB;CACnC,OAAO,IAAI,QAAQ,MAAM,GAAG;;AAG9B,MAAM,gBAAgB,QAA4B;CAChD,OAAO,OAAO,QAAQ,OAAO,QAAQ;;AAGvC,MAAM,eAAe,YAAqB;CACxC,QAAQ,CAAC,MAAM,YAAmB;EAChC,MAAM,MAAM,YAAY,KAAK;EAC7B,MAAM,WAAW,YAAY,OAAO;EACpC,MAAM,MAAM,QAAQ,KAAK;EAMzB,OAAO,CAAC,MAAA,GAAA,KAAA,SAFc,GAHT,aAAa,QAET,GAAG;GAAC;GAAK;GAAS;GAAS,GAAG,CAAC,KAAK,SAAS,CAG5C,CAAC;;;;;;;;;;;;;;;;;AAkBvB,MAAa,eAAe,aAAsB;CAChD,MAAM,QAAQ,UAAU,iBAAiB;CACzC,IAAI,CAAC,OAAO,OAAO,EAAE;CAErB,MAAM,QADU,OAAO,QAAQ,MACV,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;EAC5C,OAAO,CAAC,KAAK,MAAM;GACnB;CAEF,MAAM,UAAU,UAAU,iBAAiB;CAC3C,MAAM,mBAAmB,MAAM,IAAI,YAAY,QAAQ,CAAC;CAGxD,OAFe,OAAO,YAAY,iBAErB;;;;;;;;;;;;;AAcf,MAAa,WAAW,cAA+B;CACrD,MAAM;CACN,SAAS;CACT,SAAQ,YAAW;EACjB,MAAM,aAAa,SAAS;EAC5B,MAAM,QAAQ,YAAY,SAAS;EAEnC,OAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG;IACH;IACD;GACF;;CAEJ"}
@@ -1,38 +0,0 @@
1
- import type { ViteUserConfig } from 'vitest/config';
2
- type TsConf = {
3
- compilerOptions?: {
4
- paths?: Record<string, string[]>;
5
- baseUrl?: string;
6
- };
7
- };
8
- type Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];
9
- /**
10
- * Add manually your alias with this function
11
- * @param tsconfig The tsconfig json
12
- * @returns a vitest config
13
- *
14
- * @example
15
- * <code>
16
- * {
17
- * test: {
18
- * alias: createAlias(tsconfig),
19
- * }
20
- * }
21
- *</code>
22
- */
23
- export declare const createAlias: (tsconfig?: TsConf) => {
24
- [k: string]: string;
25
- };
26
- /**
27
- * Plugin to add alias from tsconfig to test.alias
28
- *
29
- * @param tsconfig The tsconfig json
30
- * @returns a vitest config
31
- *
32
- * @remarks
33
- * Make sure you add "resolveJsonModule": true
34
- * inside your tsconfig.json at compilerOPtions
35
- * or add the json directly
36
- */
37
- export declare const aliasTs: (tsconfig?: TsConf) => Plugin;
38
- export {};
@@ -1,74 +0,0 @@
1
- import { resolve } from "path";
2
- //#region src/vitest-alias/vitest.ts
3
- const configPaths = (arg) => {
4
- return arg.replace("/*", "");
5
- };
6
- const checkBaseUrl = (url) => {
7
- return url && url !== "." && url !== "./";
8
- };
9
- const transformer = (baseUrl) => {
10
- return ([_key, _value]) => {
11
- const key = configPaths(_key);
12
- const lastPath = configPaths(_value);
13
- const cwd = process.cwd();
14
- return [key, resolve(...checkBaseUrl(baseUrl) ? [
15
- cwd,
16
- baseUrl,
17
- lastPath
18
- ] : [cwd, lastPath])];
19
- };
20
- };
21
- /**
22
- * Add manually your alias with this function
23
- * @param tsconfig The tsconfig json
24
- * @returns a vitest config
25
- *
26
- * @example
27
- * <code>
28
- * {
29
- * test: {
30
- * alias: createAlias(tsconfig),
31
- * }
32
- * }
33
- *</code>
34
- */
35
- const createAlias = (tsconfig) => {
36
- const paths = tsconfig?.compilerOptions?.paths;
37
- if (!paths) return {};
38
- const array = Object.entries(paths).map(([key, [value]]) => {
39
- return [key, value];
40
- });
41
- const baseUrl = tsconfig?.compilerOptions?.baseUrl;
42
- const transformedArray = array.map(transformer(baseUrl));
43
- return Object.fromEntries(transformedArray);
44
- };
45
- /**
46
- * Plugin to add alias from tsconfig to test.alias
47
- *
48
- * @param tsconfig The tsconfig json
49
- * @returns a vitest config
50
- *
51
- * @remarks
52
- * Make sure you add "resolveJsonModule": true
53
- * inside your tsconfig.json at compilerOPtions
54
- * or add the json directly
55
- */
56
- const aliasTs = (tsconfig) => ({
57
- name: "aliasTs",
58
- enforce: "pre",
59
- config: (options) => {
60
- const testConfig = options?.test;
61
- const alias = createAlias(tsconfig);
62
- return {
63
- ...options,
64
- test: {
65
- ...testConfig,
66
- alias
67
- }
68
- };
69
- }
70
- });
71
- //#endregion
72
- export { aliasTs, createAlias };
73
-
74
- //# sourceMappingURL=vitest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport type { ViteUserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: TsConf) => {\n const paths = tsconfig?.compilerOptions?.paths;\n if (!paths) return {};\n const entries = Object.entries(paths);\n const array = entries.map(([key, [value]]) => {\n return [key, value];\n }) as Entry[];\n\n const baseUrl = tsconfig?.compilerOptions?.baseUrl;\n const transformedArray = array.map(transformer(baseUrl));\n const object = Object.fromEntries(transformedArray);\n\n return object;\n};\n\n/**\n * Plugin to add alias from tsconfig to test.alias\n *\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @remarks\n * Make sure you add \"resolveJsonModule\": true\n * inside your tsconfig.json at compilerOPtions\n * or add the json directly\n */\nexport const aliasTs = (tsconfig?: TsConf): Plugin => ({\n name: 'aliasTs',\n enforce: 'pre',\n config: options => {\n const testConfig = options?.test;\n const alias = createAlias(tsconfig);\n\n return {\n ...options,\n test: {\n ...testConfig,\n alias,\n },\n };\n },\n});\n"],"mappings":";;AAcA,MAAM,eAAe,QAAgB;CACnC,OAAO,IAAI,QAAQ,MAAM,GAAG;;AAG9B,MAAM,gBAAgB,QAA4B;CAChD,OAAO,OAAO,QAAQ,OAAO,QAAQ;;AAGvC,MAAM,eAAe,YAAqB;CACxC,QAAQ,CAAC,MAAM,YAAmB;EAChC,MAAM,MAAM,YAAY,KAAK;EAC7B,MAAM,WAAW,YAAY,OAAO;EACpC,MAAM,MAAM,QAAQ,KAAK;EAMzB,OAAO,CAAC,KAFM,QAAQ,GAHT,aAAa,QAET,GAAG;GAAC;GAAK;GAAS;GAAS,GAAG,CAAC,KAAK,SAAS,CAG5C,CAAC;;;;;;;;;;;;;;;;;AAkBvB,MAAa,eAAe,aAAsB;CAChD,MAAM,QAAQ,UAAU,iBAAiB;CACzC,IAAI,CAAC,OAAO,OAAO,EAAE;CAErB,MAAM,QADU,OAAO,QAAQ,MACV,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;EAC5C,OAAO,CAAC,KAAK,MAAM;GACnB;CAEF,MAAM,UAAU,UAAU,iBAAiB;CAC3C,MAAM,mBAAmB,MAAM,IAAI,YAAY,QAAQ,CAAC;CAGxD,OAFe,OAAO,YAAY,iBAErB;;;;;;;;;;;;;AAcf,MAAa,WAAW,cAA+B;CACrD,MAAM;CACN,SAAS;CACT,SAAQ,YAAW;EACjB,MAAM,aAAa,SAAS;EAC5B,MAAM,QAAQ,YAAY,SAAS;EAEnC,OAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG;IACH;IACD;GACF;;CAEJ"}