@bemedev/dev-utils 1.1.0 → 1.2.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 +34 -0
- package/lib/_virtual/_rolldown/runtime.cjs +1 -1
- package/lib/build-tests/addTarball.cjs +5 -1
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.d.ts +3 -0
- package/lib/build-tests/addTarball.js +5 -1
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs +17 -9
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +5 -0
- package/lib/build-tests/buildPackageJson.js +17 -9
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs +3 -0
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.d.ts +3 -0
- package/lib/build-tests/cleanup.js +3 -0
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +6 -0
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.d.ts +6 -0
- package/lib/build-tests/cli/cli.js +6 -0
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/post.cjs +3 -0
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.d.ts +3 -0
- package/lib/build-tests/cli/post.js +3 -0
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +3 -0
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.d.ts +3 -0
- package/lib/build-tests/cli/pre.js +3 -0
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs +3 -0
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/cli/test.d.ts +3 -0
- package/lib/build-tests/cli/test.js +3 -0
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs +42 -0
- package/lib/build-tests/constants.cjs.map +1 -1
- package/lib/build-tests/constants.d.ts +42 -0
- package/lib/build-tests/constants.js +42 -0
- package/lib/build-tests/constants.js.map +1 -1
- package/lib/build-tests/getRelativePath.cjs +7 -0
- package/lib/build-tests/getRelativePath.cjs.map +1 -1
- package/lib/build-tests/getRelativePath.d.ts +7 -0
- package/lib/build-tests/getRelativePath.js +7 -0
- package/lib/build-tests/getRelativePath.js.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.cjs +5 -0
- package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.d.ts +5 -0
- package/lib/build-tests/getTypescriptOutdir.js +5 -0
- package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
- package/lib/build-tests/import.cjs +9 -0
- package/lib/build-tests/import.cjs.map +1 -1
- package/lib/build-tests/import.d.ts +9 -0
- package/lib/build-tests/import.js +9 -0
- package/lib/build-tests/import.js.map +1 -1
- package/lib/build-tests/imports/create.cjs +7 -0
- package/lib/build-tests/imports/create.cjs.map +1 -1
- package/lib/build-tests/imports/create.d.ts +13 -0
- package/lib/build-tests/imports/create.js +7 -0
- package/lib/build-tests/imports/create.js.map +1 -1
- package/lib/build-tests/imports/helper.cjs +9 -0
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/imports/helper.d.ts +12 -0
- package/lib/build-tests/imports/helper.js +9 -0
- package/lib/build-tests/imports/helper.js.map +1 -1
- package/lib/build-tests/pack.cjs +7 -1
- package/lib/build-tests/pack.cjs.map +1 -1
- package/lib/build-tests/pack.d.ts +5 -0
- package/lib/build-tests/pack.js +7 -1
- package/lib/build-tests/pack.js.map +1 -1
- package/lib/plugins/index.cjs +3 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/index.js +2 -0
- package/lib/plugins/suppressWarnings.cjs +37 -0
- package/lib/plugins/suppressWarnings.cjs.map +1 -0
- package/lib/plugins/suppressWarnings.d.ts +12 -0
- package/lib/plugins/suppressWarnings.js +36 -0
- package/lib/plugins/suppressWarnings.js.map +1 -0
- package/lib/rolldown-config/config.cjs +13 -5
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.d.ts +7 -0
- package/lib/rolldown-config/config.js +13 -5
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs +15 -0
- package/lib/rolldown-config/constants.cjs.map +1 -1
- package/lib/rolldown-config/constants.d.ts +15 -0
- package/lib/rolldown-config/constants.js +15 -0
- package/lib/rolldown-config/constants.js.map +1 -1
- package/lib/rolldown-config/helpers.cjs +16 -1
- package/lib/rolldown-config/helpers.cjs.map +1 -1
- package/lib/rolldown-config/helpers.d.ts +14 -0
- package/lib/rolldown-config/helpers.js +16 -1
- package/lib/rolldown-config/helpers.js.map +1 -1
- package/lib/rolldown-config/input.cjs +8 -0
- package/lib/rolldown-config/input.cjs.map +1 -1
- package/lib/rolldown-config/input.d.ts +8 -0
- package/lib/rolldown-config/input.js +8 -0
- package/lib/rolldown-config/input.js.map +1 -1
- package/lib/rolldown-config/output.cjs +8 -0
- package/lib/rolldown-config/output.cjs.map +1 -1
- package/lib/rolldown-config/output.d.ts +8 -0
- package/lib/rolldown-config/output.js +8 -0
- package/lib/rolldown-config/output.js.map +1 -1
- package/lib/rolldown-config/plugins/circulars.cjs +4 -4
- package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
- package/lib/rolldown-config/plugins/circulars.d.ts +7 -4
- package/lib/rolldown-config/plugins/circulars.js +4 -4
- package/lib/rolldown-config/plugins/circulars.js.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +10 -1
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.d.ts +10 -0
- package/lib/rolldown-config/plugins/clean.js +10 -1
- package/lib/rolldown-config/plugins/clean.js.map +1 -1
- package/lib/rolldown-config/plugins/externals.cjs +4 -3
- package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
- package/lib/rolldown-config/plugins/externals.d.ts +7 -3
- package/lib/rolldown-config/plugins/externals.js +4 -3
- package/lib/rolldown-config/plugins/externals.js.map +1 -1
- package/lib/rolldown-config/plugins/index.cjs +6 -0
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/index.d.ts +6 -0
- package/lib/rolldown-config/plugins/index.js +6 -0
- package/lib/rolldown-config/plugins/index.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.cjs +7 -0
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +15 -0
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.d.ts +15 -0
- package/lib/rolldown-config/plugins/typescript.config.js +15 -0
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.d.ts +10 -0
- package/lib/rolldown-config/plugins/typescript.fast.cjs +9 -1
- package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.fast.d.ts +10 -0
- package/lib/rolldown-config/plugins/typescript.fast.js +9 -1
- package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.js +7 -0
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/rolldown-config/types.d.ts +18 -0
- package/lib/utils/array.cjs +7 -0
- package/lib/utils/array.cjs.map +1 -1
- package/lib/utils/array.d.ts +8 -0
- package/lib/utils/array.js +7 -0
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/bemedev/globals/types.d.ts +20 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -1
- package/lib/utils/bemedev/globals/utils/expandFn.d.ts +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -1
- package/lib/utils/identity.cjs +9 -0
- package/lib/utils/identity.cjs.map +1 -1
- package/lib/utils/identity.d.ts +9 -0
- package/lib/utils/identity.js +9 -0
- package/lib/utils/identity.js.map +1 -1
- package/lib/utils/sleep.cjs +7 -0
- package/lib/utils/sleep.cjs.map +1 -1
- package/lib/utils/sleep.d.ts +7 -0
- package/lib/utils/sleep.js +7 -0
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/types.d.ts +9 -0
- package/lib/vitest-exclude/constants.cjs +3 -0
- package/lib/vitest-exclude/constants.cjs.map +1 -1
- package/lib/vitest-exclude/constants.d.ts +3 -0
- package/lib/vitest-exclude/constants.js +3 -0
- package/lib/vitest-exclude/constants.js.map +1 -1
- package/lib/vitest-exclude/types.d.ts +11 -0
- package/lib/vitest-exclude/vitest.cjs +25 -12
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.d.ts +9 -8
- package/lib/vitest-exclude/vitest.js +25 -12
- package/lib/vitest-exclude/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.utils.cjs +30 -0
- package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.utils.d.ts +30 -0
- package/lib/vitest-exclude/vitest.utils.js +30 -0
- package/lib/vitest-exclude/vitest.utils.js.map +1 -1
- package/lib/vitest-extended/acceptation.cjs +11 -2
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.d.ts +9 -1
- package/lib/vitest-extended/acceptation.js +11 -2
- package/lib/vitest-extended/acceptation.js.map +1 -1
- package/lib/vitest-extended/createTests.cjs +34 -27
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +20 -37
- package/lib/vitest-extended/createTests.js +34 -27
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/createTests.types.d.ts +13 -2
- package/lib/vitest-extended/done.cjs +18 -15
- package/lib/vitest-extended/done.cjs.map +1 -1
- package/lib/vitest-extended/done.d.ts +6 -5
- package/lib/vitest-extended/done.js +18 -15
- package/lib/vitest-extended/done.js.map +1 -1
- package/lib/vitest-extended/each/error.cjs +12 -0
- package/lib/vitest-extended/each/error.cjs.map +1 -1
- package/lib/vitest-extended/each/error.d.ts +12 -0
- package/lib/vitest-extended/each/error.js +12 -0
- package/lib/vitest-extended/each/error.js.map +1 -1
- package/lib/vitest-extended/each/error.types.d.ts +17 -0
- package/lib/vitest-extended/each/pass.cjs +9 -20
- package/lib/vitest-extended/each/pass.cjs.map +1 -1
- package/lib/vitest-extended/each/pass.d.ts +9 -20
- package/lib/vitest-extended/each/pass.js +9 -20
- package/lib/vitest-extended/each/pass.js.map +1 -1
- package/lib/vitest-extended/each/pass.types.d.ts +24 -0
- package/lib/vitest-extended/fakeWaiter.cjs +7 -0
- package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
- package/lib/vitest-extended/fakeWaiter.d.ts +32 -0
- package/lib/vitest-extended/fakeWaiter.js +7 -0
- package/lib/vitest-extended/fakeWaiter.js.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
- package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.js +11 -0
- package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.cjs +9 -4
- package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.js +9 -4
- package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.cjs +18 -0
- package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.js +18 -0
- package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
- package/lib/vitest-extended/fixtures/vitest.cjs +3 -0
- package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/vitest.js +3 -0
- package/lib/vitest-extended/fixtures/vitest.js.map +1 -1
- package/lib/vitest-extended/fixtures/zod.cjs +22 -0
- package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/zod.js +22 -0
- package/lib/vitest-extended/fixtures/zod.js.map +1 -1
- package/lib/vitest-extended/identity.cjs +18 -0
- package/lib/vitest-extended/identity.cjs.map +1 -1
- package/lib/vitest-extended/identity.d.ts +18 -0
- package/lib/vitest-extended/identity.js +18 -0
- package/lib/vitest-extended/identity.js.map +1 -1
- package/lib/vitest-extended/isDefined.cjs +9 -0
- package/lib/vitest-extended/isDefined.cjs.map +1 -1
- package/lib/vitest-extended/isDefined.d.ts +9 -0
- package/lib/vitest-extended/isDefined.js +9 -0
- package/lib/vitest-extended/isDefined.js.map +1 -1
- package/lib/vitest-extended/isFunction.cjs +7 -0
- package/lib/vitest-extended/isFunction.cjs.map +1 -1
- package/lib/vitest-extended/isFunction.d.ts +7 -0
- package/lib/vitest-extended/isFunction.js +7 -0
- package/lib/vitest-extended/isFunction.js.map +1 -1
- package/lib/vitest-extended/project.cjs +7 -0
- package/lib/vitest-extended/project.cjs.map +1 -1
- package/lib/vitest-extended/project.d.ts +7 -0
- package/lib/vitest-extended/project.js +7 -0
- package/lib/vitest-extended/project.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs +6 -0
- package/lib/vitest-extended/toArray.cjs.map +1 -1
- package/lib/vitest-extended/toArray.d.ts +6 -0
- package/lib/vitest-extended/toArray.js +6 -0
- package/lib/vitest-extended/toArray.js.map +1 -1
- package/lib/vitest-extended/toStringFlat.cjs +8 -0
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
- package/lib/vitest-extended/toStringFlat.d.ts +8 -0
- package/lib/vitest-extended/toStringFlat.js +8 -0
- package/lib/vitest-extended/toStringFlat.js.map +1 -1
- package/lib/vitest-extended/types.d.ts +64 -0
- package/package.json +14 -9
|
@@ -1,14 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File scheme identifier prefix.
|
|
3
|
+
*/
|
|
1
4
|
export declare const FILE_ORIGIN = "file";
|
|
5
|
+
/**
|
|
6
|
+
* Dev dependencies field name in package.json.
|
|
7
|
+
*/
|
|
2
8
|
export declare const devKey = "devDependencies";
|
|
9
|
+
/**
|
|
10
|
+
* Generated temporary package name.
|
|
11
|
+
*/
|
|
3
12
|
export declare const THIS1 = "this-gen-1";
|
|
13
|
+
/**
|
|
14
|
+
* Entry keys to rewrite in package.json.
|
|
15
|
+
*/
|
|
4
16
|
export declare const EXPORT_KEYS: readonly ["main", "typings", "module"];
|
|
17
|
+
/**
|
|
18
|
+
* Exports field name in package.json.
|
|
19
|
+
*/
|
|
5
20
|
export declare const EXPORT_KEY = "exports";
|
|
21
|
+
/**
|
|
22
|
+
* JSON path to compiler options output directory in tsconfig.json.
|
|
23
|
+
*/
|
|
6
24
|
export declare const PATH_OUT_DIR = "compilerOptions.outDir";
|
|
25
|
+
/**
|
|
26
|
+
* Relative current directory prefix.
|
|
27
|
+
*/
|
|
7
28
|
export declare const DOT = "./";
|
|
29
|
+
/**
|
|
30
|
+
* Bin field name in package.json.
|
|
31
|
+
*/
|
|
8
32
|
export declare const BIN_KEY = "bin";
|
|
33
|
+
/**
|
|
34
|
+
* Default relative path to tsconfig.json.
|
|
35
|
+
*/
|
|
9
36
|
export declare const TS_PATH = "./tsconfig.json";
|
|
37
|
+
/**
|
|
38
|
+
* Default relative path to package.json.
|
|
39
|
+
*/
|
|
10
40
|
export declare const PACKAGE_PATH = "./package.json";
|
|
41
|
+
/**
|
|
42
|
+
* Temporary folder name for packing tarballs.
|
|
43
|
+
*/
|
|
11
44
|
export declare const TARBALL_FOLDER = ".pack";
|
|
45
|
+
/**
|
|
46
|
+
* Extension for packed tarball archives.
|
|
47
|
+
*/
|
|
12
48
|
export declare const TARBALL_EXTENSION = ".tgz";
|
|
49
|
+
/**
|
|
50
|
+
* Shell command to remove temporary generated dependency.
|
|
51
|
+
*/
|
|
13
52
|
export declare const TEARDOWN_COMMAND = "pnpm remove this-gen-1";
|
|
53
|
+
/**
|
|
54
|
+
* Default output directory relative path.
|
|
55
|
+
*/
|
|
14
56
|
export declare const DEFAULT_OUT_DIR = "./lib";
|
|
@@ -1,21 +1,63 @@
|
|
|
1
1
|
//#region src/build-tests/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* File scheme identifier prefix.
|
|
4
|
+
*/
|
|
2
5
|
const FILE_ORIGIN = "file";
|
|
6
|
+
/**
|
|
7
|
+
* Dev dependencies field name in package.json.
|
|
8
|
+
*/
|
|
3
9
|
const devKey = "devDependencies";
|
|
10
|
+
/**
|
|
11
|
+
* Generated temporary package name.
|
|
12
|
+
*/
|
|
4
13
|
const THIS1 = "this-gen-1";
|
|
14
|
+
/**
|
|
15
|
+
* Entry keys to rewrite in package.json.
|
|
16
|
+
*/
|
|
5
17
|
const EXPORT_KEYS = [
|
|
6
18
|
"main",
|
|
7
19
|
"typings",
|
|
8
20
|
"module"
|
|
9
21
|
];
|
|
22
|
+
/**
|
|
23
|
+
* Exports field name in package.json.
|
|
24
|
+
*/
|
|
10
25
|
const EXPORT_KEY = "exports";
|
|
26
|
+
/**
|
|
27
|
+
* JSON path to compiler options output directory in tsconfig.json.
|
|
28
|
+
*/
|
|
11
29
|
const PATH_OUT_DIR = "compilerOptions.outDir";
|
|
30
|
+
/**
|
|
31
|
+
* Relative current directory prefix.
|
|
32
|
+
*/
|
|
12
33
|
const DOT = "./";
|
|
34
|
+
/**
|
|
35
|
+
* Bin field name in package.json.
|
|
36
|
+
*/
|
|
13
37
|
const BIN_KEY = "bin";
|
|
38
|
+
/**
|
|
39
|
+
* Default relative path to tsconfig.json.
|
|
40
|
+
*/
|
|
14
41
|
const TS_PATH = "./tsconfig.json";
|
|
42
|
+
/**
|
|
43
|
+
* Default relative path to package.json.
|
|
44
|
+
*/
|
|
15
45
|
const PACKAGE_PATH = "./package.json";
|
|
46
|
+
/**
|
|
47
|
+
* Temporary folder name for packing tarballs.
|
|
48
|
+
*/
|
|
16
49
|
const TARBALL_FOLDER = ".pack";
|
|
50
|
+
/**
|
|
51
|
+
* Extension for packed tarball archives.
|
|
52
|
+
*/
|
|
17
53
|
const TARBALL_EXTENSION = ".tgz";
|
|
54
|
+
/**
|
|
55
|
+
* Shell command to remove temporary generated dependency.
|
|
56
|
+
*/
|
|
18
57
|
const TEARDOWN_COMMAND = `pnpm remove ${THIS1}`;
|
|
58
|
+
/**
|
|
59
|
+
* Default output directory relative path.
|
|
60
|
+
*/
|
|
19
61
|
const DEFAULT_OUT_DIR = "./lib";
|
|
20
62
|
//#endregion
|
|
21
63
|
export { BIN_KEY, DEFAULT_OUT_DIR, DOT, EXPORT_KEY, EXPORT_KEYS, FILE_ORIGIN, PACKAGE_PATH, PATH_OUT_DIR, TARBALL_EXTENSION, TARBALL_FOLDER, TEARDOWN_COMMAND, THIS1, TS_PATH, devKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../src/build-tests/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../src/build-tests/constants.ts"],"sourcesContent":["/**\n * File scheme identifier prefix.\n */\nexport const FILE_ORIGIN = 'file';\n\n/**\n * Dev dependencies field name in package.json.\n */\nexport const devKey = 'devDependencies';\n\n/**\n * Generated temporary package name.\n */\nexport const THIS1 = 'this-gen-1';\n\n/**\n * Entry keys to rewrite in package.json.\n */\nexport const EXPORT_KEYS = ['main', 'typings', 'module'] as const;\n\n/**\n * Exports field name in package.json.\n */\nexport const EXPORT_KEY = 'exports';\n\n/**\n * JSON path to compiler options output directory in tsconfig.json.\n */\nexport const PATH_OUT_DIR = 'compilerOptions.outDir';\n\n/**\n * Relative current directory prefix.\n */\nexport const DOT = './';\n\n/**\n * Bin field name in package.json.\n */\nexport const BIN_KEY = 'bin';\n\n/**\n * Default relative path to tsconfig.json.\n */\nexport const TS_PATH = './tsconfig.json';\n\n/**\n * Default relative path to package.json.\n */\nexport const PACKAGE_PATH = './package.json';\n\n/**\n * Temporary folder name for packing tarballs.\n */\nexport const TARBALL_FOLDER = '.pack';\n\n/**\n * Extension for packed tarball archives.\n */\nexport const TARBALL_EXTENSION = '.tgz';\n\n/**\n * Shell command to remove temporary generated dependency.\n */\nexport const TEARDOWN_COMMAND = `pnpm remove ${THIS1}`;\n\n/**\n * Default output directory relative path.\n */\nexport const DEFAULT_OUT_DIR = './lib';\n\n// export const FIXTURES = {\n// true: 'true',\n// false: 'false',\n// recursive: 'TEST_RECURSIVE',\n// vitest: 'VITEST_VSCODE',\n// } as const;\n"],"mappings":";;;;AAGA,MAAa,cAAc;;;;AAK3B,MAAa,SAAS;;;;AAKtB,MAAa,QAAQ;;;;AAKrB,MAAa,cAAc;CAAC;CAAQ;CAAW;AAAQ;;;;AAKvD,MAAa,aAAa;;;;AAK1B,MAAa,eAAe;;;;AAK5B,MAAa,MAAM;;;;AAKnB,MAAa,UAAU;;;;AAKvB,MAAa,UAAU;;;;AAKvB,MAAa,eAAe;;;;AAK5B,MAAa,iBAAiB;;;;AAK9B,MAAa,oBAAoB;;;;AAKjC,MAAa,mBAAmB,eAAe;;;;AAK/C,MAAa,kBAAkB"}
|
|
@@ -2,6 +2,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_build_tests_constants = require("./constants.cjs");
|
|
3
3
|
let path = require("path");
|
|
4
4
|
//#region src/build-tests/getRelativePath.ts
|
|
5
|
+
/**
|
|
6
|
+
* Extracts and computes the relative path to the generated tarball file from pack output.
|
|
7
|
+
*
|
|
8
|
+
* @param result - Shell stdout output from `pnpm pack`.
|
|
9
|
+
*
|
|
10
|
+
* @returns Relative path to the tarball archive.
|
|
11
|
+
*/
|
|
5
12
|
const getRelativePath0 = (result) => {
|
|
6
13
|
const out1 = result.split("\n").find((val) => val.endsWith(require_build_tests_constants.TARBALL_EXTENSION));
|
|
7
14
|
return (0, path.relative)(process.cwd(), out1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelativePath.cjs","names":["TARBALL_EXTENSION"],"sources":["../../src/build-tests/getRelativePath.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport type { Fn } from '#utils/types';\n\nimport { TARBALL_EXTENSION } from './constants';\n\ntype GetRelativePath_F = Fn<[string], string>;\n\nexport const getRelativePath0: GetRelativePath_F = result => {\n const split = result.split('\\n');\n const out1 = split.find(val => val.endsWith(TARBALL_EXTENSION));\n const out2 = relative(process.cwd(), out1!);\n\n return out2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getRelativePath.cjs","names":["TARBALL_EXTENSION","relative"],"sources":["../../src/build-tests/getRelativePath.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport type { Fn } from '#utils/types';\n\nimport { TARBALL_EXTENSION } from './constants';\n\ntype GetRelativePath_F = Fn<[string], string>;\n\n/**\n * Extracts and computes the relative path to the generated tarball file from pack output.\n *\n * @param result - Shell stdout output from `pnpm pack`.\n *\n * @returns Relative path to the tarball archive.\n */\nexport const getRelativePath0: GetRelativePath_F = result => {\n const split = result.split('\\n');\n const out1 = split.find(val => val.endsWith(TARBALL_EXTENSION));\n const out2 = relative(process.cwd(), out1!);\n\n return out2;\n};\n"],"mappings":";;;;;;;;;;;AAeA,MAAa,oBAAsC,WAAU;CAE3D,MAAM,OADQ,OAAO,MAAM,IACV,CAAC,CAAC,MAAK,QAAO,IAAI,SAASA,8BAAAA,iBAAiB,CAAC;CAG9D,QAAA,GAFaC,KAAAA,SAAAA,CAAS,QAAQ,IAAI,GAAG,IAE3B;AACZ"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { Fn } from '../utils/types';
|
|
2
2
|
type GetRelativePath_F = Fn<[string], string>;
|
|
3
|
+
/**
|
|
4
|
+
* Extracts and computes the relative path to the generated tarball file from pack output.
|
|
5
|
+
*
|
|
6
|
+
* @param result - Shell stdout output from `pnpm pack`.
|
|
7
|
+
*
|
|
8
|
+
* @returns Relative path to the tarball archive.
|
|
9
|
+
*/
|
|
3
10
|
export declare const getRelativePath0: GetRelativePath_F;
|
|
4
11
|
export {};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { TARBALL_EXTENSION } from "./constants.js";
|
|
2
2
|
import { relative } from "path";
|
|
3
3
|
//#region src/build-tests/getRelativePath.ts
|
|
4
|
+
/**
|
|
5
|
+
* Extracts and computes the relative path to the generated tarball file from pack output.
|
|
6
|
+
*
|
|
7
|
+
* @param result - Shell stdout output from `pnpm pack`.
|
|
8
|
+
*
|
|
9
|
+
* @returns Relative path to the tarball archive.
|
|
10
|
+
*/
|
|
4
11
|
const getRelativePath0 = (result) => {
|
|
5
12
|
const out1 = result.split("\n").find((val) => val.endsWith(TARBALL_EXTENSION));
|
|
6
13
|
return relative(process.cwd(), out1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelativePath.js","names":[],"sources":["../../src/build-tests/getRelativePath.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport type { Fn } from '#utils/types';\n\nimport { TARBALL_EXTENSION } from './constants';\n\ntype GetRelativePath_F = Fn<[string], string>;\n\nexport const getRelativePath0: GetRelativePath_F = result => {\n const split = result.split('\\n');\n const out1 = split.find(val => val.endsWith(TARBALL_EXTENSION));\n const out2 = relative(process.cwd(), out1!);\n\n return out2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getRelativePath.js","names":[],"sources":["../../src/build-tests/getRelativePath.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport type { Fn } from '#utils/types';\n\nimport { TARBALL_EXTENSION } from './constants';\n\ntype GetRelativePath_F = Fn<[string], string>;\n\n/**\n * Extracts and computes the relative path to the generated tarball file from pack output.\n *\n * @param result - Shell stdout output from `pnpm pack`.\n *\n * @returns Relative path to the tarball archive.\n */\nexport const getRelativePath0: GetRelativePath_F = result => {\n const split = result.split('\\n');\n const out1 = split.find(val => val.endsWith(TARBALL_EXTENSION));\n const out2 = relative(process.cwd(), out1!);\n\n return out2;\n};\n"],"mappings":";;;;;;;;;;AAeA,MAAa,oBAAsC,WAAU;CAE3D,MAAM,OADQ,OAAO,MAAM,IACV,CAAC,CAAC,MAAK,QAAO,IAAI,SAAS,iBAAiB,CAAC;CAG9D,OAFa,SAAS,QAAQ,IAAI,GAAG,IAE3B;AACZ"}
|
|
@@ -5,6 +5,11 @@ let path = require("path");
|
|
|
5
5
|
let edit_json_file = require("edit-json-file");
|
|
6
6
|
edit_json_file = require_runtime.__toESM(edit_json_file, 1);
|
|
7
7
|
//#region src/build-tests/getTypescriptOutdir.ts
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the TypeScript output directory specified in `tsconfig.json`.
|
|
10
|
+
*
|
|
11
|
+
* @returns Output directory path string without leading `./`.
|
|
12
|
+
*/
|
|
8
13
|
const getTypescriptOutdir = () => {
|
|
9
14
|
let file = (0, edit_json_file.default)((0, path.resolve)(process.cwd(), require_build_tests_constants.TS_PATH));
|
|
10
15
|
const outDir1 = file.get("compilerOptions.outDir") ?? "./lib";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypescriptOutdir.cjs","names":["TS_PATH"],"sources":["../../src/build-tests/getTypescriptOutdir.ts"],"sourcesContent":["import { resolve } from 'path';\n\nimport editJsonFile, { type JsonEditor } from 'edit-json-file';\n\nimport type { Fn } from '#utils/types';\n\nimport { DEFAULT_OUT_DIR, DOT, PATH_OUT_DIR, TS_PATH } from './constants';\n\ntype Fn1 = Fn<[], string>;\n\nexport const getTypescriptOutdir: Fn1 = () => {\n let file: JsonEditor | undefined = editJsonFile(\n resolve(process.cwd(), TS_PATH),\n );\n\n const outDir1 = file.get(PATH_OUT_DIR) ?? DEFAULT_OUT_DIR;\n /* v8 ignore next 3 */\n const outDir2 = outDir1.startsWith(DOT)\n ? outDir1.replace(DOT, '')\n : outDir1;\n\n file = undefined;\n return outDir2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTypescriptOutdir.cjs","names":["editJsonFile","resolve","TS_PATH"],"sources":["../../src/build-tests/getTypescriptOutdir.ts"],"sourcesContent":["import { resolve } from 'path';\n\nimport editJsonFile, { type JsonEditor } from 'edit-json-file';\n\nimport type { Fn } from '#utils/types';\n\nimport { DEFAULT_OUT_DIR, DOT, PATH_OUT_DIR, TS_PATH } from './constants';\n\ntype Fn1 = Fn<[], string>;\n\n/**\n * Resolves the TypeScript output directory specified in `tsconfig.json`.\n *\n * @returns Output directory path string without leading `./`.\n */\nexport const getTypescriptOutdir: Fn1 = () => {\n let file: JsonEditor | undefined = editJsonFile(\n resolve(process.cwd(), TS_PATH),\n );\n\n const outDir1 = file.get(PATH_OUT_DIR) ?? DEFAULT_OUT_DIR;\n /* v8 ignore next 3 */\n const outDir2 = outDir1.startsWith(DOT)\n ? outDir1.replace(DOT, '')\n : outDir1;\n\n file = undefined;\n return outDir2;\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,4BAAiC;CAC5C,IAAI,QAAA,GAA+BA,eAAAA,QAAAA,EAAAA,GACjCC,KAAAA,QAAAA,CAAQ,QAAQ,IAAI,GAAGC,8BAAAA,OAAO,CAChC;CAEA,MAAM,UAAU,KAAK,IAAA,wBAAgB,KAAA;;CAErC,MAAM,UAAU,QAAQ,WAAA,IAAc,IAClC,QAAQ,QAAA,MAAa,EAAE,IACvB;CAEJ,OAAO,KAAA;CACP,OAAO;AACT"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Fn } from '../utils/types';
|
|
2
2
|
type Fn1 = Fn<[], string>;
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the TypeScript output directory specified in `tsconfig.json`.
|
|
5
|
+
*
|
|
6
|
+
* @returns Output directory path string without leading `./`.
|
|
7
|
+
*/
|
|
3
8
|
export declare const getTypescriptOutdir: Fn1;
|
|
4
9
|
export {};
|
|
@@ -2,6 +2,11 @@ import { TS_PATH } from "./constants.js";
|
|
|
2
2
|
import { resolve } from "path";
|
|
3
3
|
import editJsonFile from "edit-json-file";
|
|
4
4
|
//#region src/build-tests/getTypescriptOutdir.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the TypeScript output directory specified in `tsconfig.json`.
|
|
7
|
+
*
|
|
8
|
+
* @returns Output directory path string without leading `./`.
|
|
9
|
+
*/
|
|
5
10
|
const getTypescriptOutdir = () => {
|
|
6
11
|
let file = editJsonFile(resolve(process.cwd(), TS_PATH));
|
|
7
12
|
const outDir1 = file.get("compilerOptions.outDir") ?? "./lib";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypescriptOutdir.js","names":[],"sources":["../../src/build-tests/getTypescriptOutdir.ts"],"sourcesContent":["import { resolve } from 'path';\n\nimport editJsonFile, { type JsonEditor } from 'edit-json-file';\n\nimport type { Fn } from '#utils/types';\n\nimport { DEFAULT_OUT_DIR, DOT, PATH_OUT_DIR, TS_PATH } from './constants';\n\ntype Fn1 = Fn<[], string>;\n\nexport const getTypescriptOutdir: Fn1 = () => {\n let file: JsonEditor | undefined = editJsonFile(\n resolve(process.cwd(), TS_PATH),\n );\n\n const outDir1 = file.get(PATH_OUT_DIR) ?? DEFAULT_OUT_DIR;\n /* v8 ignore next 3 */\n const outDir2 = outDir1.startsWith(DOT)\n ? outDir1.replace(DOT, '')\n : outDir1;\n\n file = undefined;\n return outDir2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTypescriptOutdir.js","names":[],"sources":["../../src/build-tests/getTypescriptOutdir.ts"],"sourcesContent":["import { resolve } from 'path';\n\nimport editJsonFile, { type JsonEditor } from 'edit-json-file';\n\nimport type { Fn } from '#utils/types';\n\nimport { DEFAULT_OUT_DIR, DOT, PATH_OUT_DIR, TS_PATH } from './constants';\n\ntype Fn1 = Fn<[], string>;\n\n/**\n * Resolves the TypeScript output directory specified in `tsconfig.json`.\n *\n * @returns Output directory path string without leading `./`.\n */\nexport const getTypescriptOutdir: Fn1 = () => {\n let file: JsonEditor | undefined = editJsonFile(\n resolve(process.cwd(), TS_PATH),\n );\n\n const outDir1 = file.get(PATH_OUT_DIR) ?? DEFAULT_OUT_DIR;\n /* v8 ignore next 3 */\n const outDir2 = outDir1.startsWith(DOT)\n ? outDir1.replace(DOT, '')\n : outDir1;\n\n file = undefined;\n return outDir2;\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,4BAAiC;CAC5C,IAAI,OAA+B,aACjC,QAAQ,QAAQ,IAAI,GAAG,OAAO,CAChC;CAEA,MAAM,UAAU,KAAK,IAAA,wBAAgB,KAAA;;CAErC,MAAM,UAAU,QAAQ,WAAA,IAAc,IAClC,QAAQ,QAAA,MAAa,EAAE,IACvB;CAEJ,OAAO,KAAA;CACP,OAAO;AACT"}
|
|
@@ -2,6 +2,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_utils_identity = require("../utils/identity.cjs");
|
|
3
3
|
const require_build_tests_constants = require("./constants.cjs");
|
|
4
4
|
//#region src/build-tests/import.ts
|
|
5
|
+
/**
|
|
6
|
+
* Dynamically imports a module or submodule from the generated test package.
|
|
7
|
+
*
|
|
8
|
+
* @template `T` - Extracted return type.
|
|
9
|
+
*
|
|
10
|
+
* @param args - Import options containing submodule path and extractor function.
|
|
11
|
+
*
|
|
12
|
+
* @returns Promise resolving to the extracted module value.
|
|
13
|
+
*/
|
|
5
14
|
const customImport = async ({ path = "", fn = require_utils_identity.identity }) => {
|
|
6
15
|
return fn(await (path === "" ? import(require_build_tests_constants.THIS1) : import(`${require_build_tests_constants.THIS1}/${path}`)));
|
|
7
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.cjs","names":["identity","THIS1"],"sources":["../../src/build-tests/import.ts"],"sourcesContent":["import { identity } from '#utils';\n\nimport { THIS1 } from './constants';\n\ntype Args<T = any> = { path?: string; fn: (out: any) => T };\n\ntype CustomImport_F = <T = any>(args: Args<T>) => Promise<T>;\n\nexport const customImport: CustomImport_F = async ({\n path = '',\n fn = identity,\n}: Args) => {\n const _path = path === '' ? THIS1 : `${THIS1}/${path}`;\n const out = await import(_path);\n const out2 = fn(out);\n return out2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"import.cjs","names":["identity","THIS1"],"sources":["../../src/build-tests/import.ts"],"sourcesContent":["import { identity } from '#utils';\n\nimport { THIS1 } from './constants';\n\ntype Args<T = any> = { path?: string; fn: (out: any) => T };\n\ntype CustomImport_F = <T = any>(args: Args<T>) => Promise<T>;\n\n/**\n * Dynamically imports a module or submodule from the generated test package.\n *\n * @template `T` - Extracted return type.\n *\n * @param args - Import options containing submodule path and extractor function.\n *\n * @returns Promise resolving to the extracted module value.\n */\nexport const customImport: CustomImport_F = async ({\n path = '',\n fn = identity,\n}: Args) => {\n const _path = path === '' ? THIS1 : `${THIS1}/${path}`;\n const out = await import(_path);\n const out2 = fn(out);\n return out2;\n};\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAa,eAA+B,OAAO,EACjD,OAAO,IACP,KAAKA,uBAAAA,eACK;CAIV,OADa,GAAG,OAFF,SAAS,KAAA,OAAKC,8BAAAA,SAAAA,OAAQ,GAAGA,8BAAAA,MAAM,GAAG,QAGtC;AACZ"}
|
|
@@ -3,5 +3,14 @@ type Args<T = any> = {
|
|
|
3
3
|
fn: (out: any) => T;
|
|
4
4
|
};
|
|
5
5
|
type CustomImport_F = <T = any>(args: Args<T>) => Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Dynamically imports a module or submodule from the generated test package.
|
|
8
|
+
*
|
|
9
|
+
* @template `T` - Extracted return type.
|
|
10
|
+
*
|
|
11
|
+
* @param args - Import options containing submodule path and extractor function.
|
|
12
|
+
*
|
|
13
|
+
* @returns Promise resolving to the extracted module value.
|
|
14
|
+
*/
|
|
6
15
|
export declare const customImport: CustomImport_F;
|
|
7
16
|
export {};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { identity } from "../utils/identity.js";
|
|
2
2
|
import { THIS1 } from "./constants.js";
|
|
3
3
|
//#region src/build-tests/import.ts
|
|
4
|
+
/**
|
|
5
|
+
* Dynamically imports a module or submodule from the generated test package.
|
|
6
|
+
*
|
|
7
|
+
* @template `T` - Extracted return type.
|
|
8
|
+
*
|
|
9
|
+
* @param args - Import options containing submodule path and extractor function.
|
|
10
|
+
*
|
|
11
|
+
* @returns Promise resolving to the extracted module value.
|
|
12
|
+
*/
|
|
4
13
|
const customImport = async ({ path = "", fn = identity }) => {
|
|
5
14
|
return fn(await (path === "" ? import(THIS1) : import(`${THIS1}/${path}`)));
|
|
6
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.js","names":[],"sources":["../../src/build-tests/import.ts"],"sourcesContent":["import { identity } from '#utils';\n\nimport { THIS1 } from './constants';\n\ntype Args<T = any> = { path?: string; fn: (out: any) => T };\n\ntype CustomImport_F = <T = any>(args: Args<T>) => Promise<T>;\n\nexport const customImport: CustomImport_F = async ({\n path = '',\n fn = identity,\n}: Args) => {\n const _path = path === '' ? THIS1 : `${THIS1}/${path}`;\n const out = await import(_path);\n const out2 = fn(out);\n return out2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"import.js","names":[],"sources":["../../src/build-tests/import.ts"],"sourcesContent":["import { identity } from '#utils';\n\nimport { THIS1 } from './constants';\n\ntype Args<T = any> = { path?: string; fn: (out: any) => T };\n\ntype CustomImport_F = <T = any>(args: Args<T>) => Promise<T>;\n\n/**\n * Dynamically imports a module or submodule from the generated test package.\n *\n * @template `T` - Extracted return type.\n *\n * @param args - Import options containing submodule path and extractor function.\n *\n * @returns Promise resolving to the extracted module value.\n */\nexport const customImport: CustomImport_F = async ({\n path = '',\n fn = identity,\n}: Args) => {\n const _path = path === '' ? THIS1 : `${THIS1}/${path}`;\n const out = await import(_path);\n const out2 = fn(out);\n return out2;\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,eAA+B,OAAO,EACjD,OAAO,IACP,KAAK,eACK;CAIV,OADa,GAAG,OAFF,SAAS,KAAA,OAAK,SAAA,OAAQ,GAAG,MAAM,GAAG,QAGtC;AACZ"}
|
|
@@ -3,6 +3,13 @@ const require_vitest_extended_toStringFlat = require("../../vitest-extended/toSt
|
|
|
3
3
|
const require_build_tests_imports_helper = require("./helper.cjs");
|
|
4
4
|
let vitest = require("vitest");
|
|
5
5
|
//#region src/build-tests/imports/create.ts
|
|
6
|
+
/**
|
|
7
|
+
* Creates Vitest test suites verifying that symbols are properly exported from a module.
|
|
8
|
+
*
|
|
9
|
+
* @param args - Import test arguments of type {@linkcode ImportArgs}.
|
|
10
|
+
*
|
|
11
|
+
* @returns Tuple of test description and test runner function.
|
|
12
|
+
*/
|
|
6
13
|
const createImportFnTests = (args) => {
|
|
7
14
|
const path = args.path;
|
|
8
15
|
const invite = `Importing from ${path ?? "index"}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.cjs","names":["helperFn","toStringFlat"],"sources":["../../../src/build-tests/imports/create.ts"],"sourcesContent":["import { describe, test } from 'vitest';\n\nimport { toStringFlat } from '../../vitest-extended/toStringFlat';\nimport { helperFn } from './helper';\n\nexport type ImportArgs = {\n path?: string;\n FAILS?: string[];\n SUCCESS: string[];\n};\n\nexport type CreateImportTest_F = (\n args: ImportArgs,\n) => readonly [string, () => void];\n\nexport const createImportFnTests: CreateImportTest_F = args => {\n const path = args.path;\n const invite = `Importing from ${path ?? 'index'}`;\n const testFn = (fn: string) => helperFn({ path, fn });\n\n const fn = () => {\n describe.skipIf(args.SUCCESS.length < 1)(\n '#01 => Functions are inside the module',\n () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.SUCCESS.length);\n };\n\n args.SUCCESS.forEach((fn, index) => {\n test(`#${_index(index)} => should succeed with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n },\n );\n\n if (!args.FAILS || args.FAILS.length < 1) return;\n\n describe('#02 => Functions are not inside the module', () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.FAILS!.length);\n };\n\n args.FAILS!.forEach((fn, index) => {\n test.fails(`#${_index(index)} => should fail with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n });\n };\n\n return [invite, fn] as const;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.cjs","names":["helperFn","toStringFlat"],"sources":["../../../src/build-tests/imports/create.ts"],"sourcesContent":["import { describe, test } from 'vitest';\n\nimport { toStringFlat } from '../../vitest-extended/toStringFlat';\nimport { helperFn } from './helper';\n\n/**\n * Options defining expected exported and non-exported symbols.\n */\nexport type ImportArgs = {\n path?: string;\n FAILS?: string[];\n SUCCESS: string[];\n};\n\n/**\n * Function type creating import test suites.\n */\nexport type CreateImportTest_F = (\n args: ImportArgs,\n) => readonly [string, () => void];\n\n/**\n * Creates Vitest test suites verifying that symbols are properly exported from a module.\n *\n * @param args - Import test arguments of type {@linkcode ImportArgs}.\n *\n * @returns Tuple of test description and test runner function.\n */\nexport const createImportFnTests: CreateImportTest_F = args => {\n const path = args.path;\n const invite = `Importing from ${path ?? 'index'}`;\n const testFn = (fn: string) => helperFn({ path, fn });\n\n const fn = () => {\n describe.skipIf(args.SUCCESS.length < 1)(\n '#01 => Functions are inside the module',\n () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.SUCCESS.length);\n };\n\n args.SUCCESS.forEach((fn, index) => {\n test(`#${_index(index)} => should succeed with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n },\n );\n\n if (!args.FAILS || args.FAILS.length < 1) return;\n\n describe('#02 => Functions are not inside the module', () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.FAILS!.length);\n };\n\n args.FAILS!.forEach((fn, index) => {\n test.fails(`#${_index(index)} => should fail with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n });\n };\n\n return [invite, fn] as const;\n};\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAa,uBAA0C,SAAQ;CAC7D,MAAM,OAAO,KAAK;CAClB,MAAM,SAAS,kBAAkB,QAAQ;CACzC,MAAM,UAAU,OAAeA,mCAAAA,SAAS;EAAE;EAAM;CAAG,CAAC;CAEpD,MAAM,WAAW;EACf,OAAA,SAAS,OAAO,KAAK,QAAQ,SAAS,CAAC,CAAC,CACtC,gDACM;GACJ,MAAM,UAAU,UAAkB;IAChC,OAAOC,qCAAAA,aAAa,QAAQ,GAAG,KAAK,QAAQ,MAAM;GACpD;GAEA,KAAK,QAAQ,SAAS,IAAI,UAAU;IAClC,CAAA,GAAA,OAAA,KAAA,CAAK,IAAI,OAAO,KAAK,EAAE,mCAAmC,YAAY;KACpE,OAAO,OAAO,EAAE;IAClB,CAAC;GACH,CAAC;EACH,CACF;EAEA,IAAI,CAAC,KAAK,SAAS,KAAK,MAAM,SAAS,GAAG;EAE1C,CAAA,GAAA,OAAA,SAAA,CAAS,oDAAoD;GAC3D,MAAM,UAAU,UAAkB;IAChC,OAAOA,qCAAAA,aAAa,QAAQ,GAAG,KAAK,MAAO,MAAM;GACnD;GAEA,KAAK,MAAO,SAAS,IAAI,UAAU;IACjC,OAAA,KAAK,MAAM,IAAI,OAAO,KAAK,EAAE,gCAAgC,YAAY;KACvE,OAAO,OAAO,EAAE;IAClB,CAAC;GACH,CAAC;EACH,CAAC;CACH;CAEA,OAAO,CAAC,QAAQ,EAAE;AACpB"}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options defining expected exported and non-exported symbols.
|
|
3
|
+
*/
|
|
1
4
|
export type ImportArgs = {
|
|
2
5
|
path?: string;
|
|
3
6
|
FAILS?: string[];
|
|
4
7
|
SUCCESS: string[];
|
|
5
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Function type creating import test suites.
|
|
11
|
+
*/
|
|
6
12
|
export type CreateImportTest_F = (args: ImportArgs) => readonly [string, () => void];
|
|
13
|
+
/**
|
|
14
|
+
* Creates Vitest test suites verifying that symbols are properly exported from a module.
|
|
15
|
+
*
|
|
16
|
+
* @param args - Import test arguments of type {@linkcode ImportArgs}.
|
|
17
|
+
*
|
|
18
|
+
* @returns Tuple of test description and test runner function.
|
|
19
|
+
*/
|
|
7
20
|
export declare const createImportFnTests: CreateImportTest_F;
|
|
@@ -2,6 +2,13 @@ import { toStringFlat } from "../../vitest-extended/toStringFlat.js";
|
|
|
2
2
|
import { helperFn } from "./helper.js";
|
|
3
3
|
import { describe, test } from "vitest";
|
|
4
4
|
//#region src/build-tests/imports/create.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates Vitest test suites verifying that symbols are properly exported from a module.
|
|
7
|
+
*
|
|
8
|
+
* @param args - Import test arguments of type {@linkcode ImportArgs}.
|
|
9
|
+
*
|
|
10
|
+
* @returns Tuple of test description and test runner function.
|
|
11
|
+
*/
|
|
5
12
|
const createImportFnTests = (args) => {
|
|
6
13
|
const path = args.path;
|
|
7
14
|
const invite = `Importing from ${path ?? "index"}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","names":[],"sources":["../../../src/build-tests/imports/create.ts"],"sourcesContent":["import { describe, test } from 'vitest';\n\nimport { toStringFlat } from '../../vitest-extended/toStringFlat';\nimport { helperFn } from './helper';\n\nexport type ImportArgs = {\n path?: string;\n FAILS?: string[];\n SUCCESS: string[];\n};\n\nexport type CreateImportTest_F = (\n args: ImportArgs,\n) => readonly [string, () => void];\n\nexport const createImportFnTests: CreateImportTest_F = args => {\n const path = args.path;\n const invite = `Importing from ${path ?? 'index'}`;\n const testFn = (fn: string) => helperFn({ path, fn });\n\n const fn = () => {\n describe.skipIf(args.SUCCESS.length < 1)(\n '#01 => Functions are inside the module',\n () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.SUCCESS.length);\n };\n\n args.SUCCESS.forEach((fn, index) => {\n test(`#${_index(index)} => should succeed with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n },\n );\n\n if (!args.FAILS || args.FAILS.length < 1) return;\n\n describe('#02 => Functions are not inside the module', () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.FAILS!.length);\n };\n\n args.FAILS!.forEach((fn, index) => {\n test.fails(`#${_index(index)} => should fail with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n });\n };\n\n return [invite, fn] as const;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.js","names":[],"sources":["../../../src/build-tests/imports/create.ts"],"sourcesContent":["import { describe, test } from 'vitest';\n\nimport { toStringFlat } from '../../vitest-extended/toStringFlat';\nimport { helperFn } from './helper';\n\n/**\n * Options defining expected exported and non-exported symbols.\n */\nexport type ImportArgs = {\n path?: string;\n FAILS?: string[];\n SUCCESS: string[];\n};\n\n/**\n * Function type creating import test suites.\n */\nexport type CreateImportTest_F = (\n args: ImportArgs,\n) => readonly [string, () => void];\n\n/**\n * Creates Vitest test suites verifying that symbols are properly exported from a module.\n *\n * @param args - Import test arguments of type {@linkcode ImportArgs}.\n *\n * @returns Tuple of test description and test runner function.\n */\nexport const createImportFnTests: CreateImportTest_F = args => {\n const path = args.path;\n const invite = `Importing from ${path ?? 'index'}`;\n const testFn = (fn: string) => helperFn({ path, fn });\n\n const fn = () => {\n describe.skipIf(args.SUCCESS.length < 1)(\n '#01 => Functions are inside the module',\n () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.SUCCESS.length);\n };\n\n args.SUCCESS.forEach((fn, index) => {\n test(`#${_index(index)} => should succeed with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n },\n );\n\n if (!args.FAILS || args.FAILS.length < 1) return;\n\n describe('#02 => Functions are not inside the module', () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.FAILS!.length);\n };\n\n args.FAILS!.forEach((fn, index) => {\n test.fails(`#${_index(index)} => should fail with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n });\n };\n\n return [invite, fn] as const;\n};\n"],"mappings":";;;;;;;;;;;AA4BA,MAAa,uBAA0C,SAAQ;CAC7D,MAAM,OAAO,KAAK;CAClB,MAAM,SAAS,kBAAkB,QAAQ;CACzC,MAAM,UAAU,OAAe,SAAS;EAAE;EAAM;CAAG,CAAC;CAEpD,MAAM,WAAW;EACf,SAAS,OAAO,KAAK,QAAQ,SAAS,CAAC,CAAC,CACtC,gDACM;GACJ,MAAM,UAAU,UAAkB;IAChC,OAAO,aAAa,QAAQ,GAAG,KAAK,QAAQ,MAAM;GACpD;GAEA,KAAK,QAAQ,SAAS,IAAI,UAAU;IAClC,KAAK,IAAI,OAAO,KAAK,EAAE,mCAAmC,YAAY;KACpE,OAAO,OAAO,EAAE;IAClB,CAAC;GACH,CAAC;EACH,CACF;EAEA,IAAI,CAAC,KAAK,SAAS,KAAK,MAAM,SAAS,GAAG;EAE1C,SAAS,oDAAoD;GAC3D,MAAM,UAAU,UAAkB;IAChC,OAAO,aAAa,QAAQ,GAAG,KAAK,MAAO,MAAM;GACnD;GAEA,KAAK,MAAO,SAAS,IAAI,UAAU;IACjC,KAAK,MAAM,IAAI,OAAO,KAAK,EAAE,gCAAgC,YAAY;KACvE,OAAO,OAAO,EAAE;IAClB,CAAC;GACH,CAAC;EACH,CAAC;CACH;CAEA,OAAO,CAAC,QAAQ,EAAE;AACpB"}
|
|
@@ -2,6 +2,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_build_tests_import = require("../import.cjs");
|
|
3
3
|
let vitest = require("vitest");
|
|
4
4
|
//#region src/build-tests/imports/helper.ts
|
|
5
|
+
/**
|
|
6
|
+
* Asserts that a specified function is defined and exported from a module.
|
|
7
|
+
*
|
|
8
|
+
* @template | {@linkcode Fn} `T` - Expected function type.
|
|
9
|
+
*
|
|
10
|
+
* @param args - Options object.
|
|
11
|
+
* @param args.path - Submodule path to import from.
|
|
12
|
+
* @param args.fn - Named export function name.
|
|
13
|
+
*/
|
|
5
14
|
const helperFn = async ({ path, fn }) => {
|
|
6
15
|
const _fn = await require_build_tests_import.customImport({
|
|
7
16
|
path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.cjs","names":["customImport"],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\nexport type Helper_F = (args: {\n path?: string;\n fn: string;\n}) => Promise<void>;\n\nexport const helperFn = async <T extends Fn = Fn>({\n path,\n fn,\n}: {\n path?: string;\n fn: string;\n}) => {\n const _fn = await customImport<T>({ path, fn: m => m[fn] });\n expect(_fn).toBeDefined();\n expect(_fn).toBeTypeOf('function');\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.cjs","names":["customImport"],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\n/**\n * Helper function type for verifying exported functions.\n */\nexport type Helper_F = (args: {\n path?: string;\n fn: string;\n}) => Promise<void>;\n\n/**\n * Asserts that a specified function is defined and exported from a module.\n *\n * @template | {@linkcode Fn} `T` - Expected function type.\n *\n * @param args - Options object.\n * @param args.path - Submodule path to import from.\n * @param args.fn - Named export function name.\n */\nexport const helperFn = async <T extends Fn = Fn>({\n path,\n fn,\n}: {\n path?: string;\n fn: string;\n}) => {\n const _fn = await customImport<T>({ path, fn: m => m[fn] });\n expect(_fn).toBeDefined();\n expect(_fn).toBeTypeOf('function');\n};\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAa,WAAW,OAA0B,EAChD,MACA,SAII;CACJ,MAAM,MAAM,MAAMA,2BAAAA,aAAgB;EAAE;EAAM,KAAI,MAAK,EAAE;CAAI,CAAC;CAC1D,CAAA,GAAA,OAAA,OAAA,CAAO,GAAG,CAAC,CAAC,YAAY;CACxB,CAAA,GAAA,OAAA,OAAA,CAAO,GAAG,CAAC,CAAC,WAAW,UAAU;AACnC"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { Fn } from '../../utils/bemedev/globals/types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function type for verifying exported functions.
|
|
4
|
+
*/
|
|
2
5
|
export type Helper_F = (args: {
|
|
3
6
|
path?: string;
|
|
4
7
|
fn: string;
|
|
5
8
|
}) => Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Asserts that a specified function is defined and exported from a module.
|
|
11
|
+
*
|
|
12
|
+
* @template | {@linkcode Fn} `T` - Expected function type.
|
|
13
|
+
*
|
|
14
|
+
* @param args - Options object.
|
|
15
|
+
* @param args.path - Submodule path to import from.
|
|
16
|
+
* @param args.fn - Named export function name.
|
|
17
|
+
*/
|
|
6
18
|
export declare const helperFn: <T extends Fn = Fn>({ path, fn, }: {
|
|
7
19
|
path?: string;
|
|
8
20
|
fn: string;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { customImport } from "../import.js";
|
|
2
2
|
import { expect } from "vitest";
|
|
3
3
|
//#region src/build-tests/imports/helper.ts
|
|
4
|
+
/**
|
|
5
|
+
* Asserts that a specified function is defined and exported from a module.
|
|
6
|
+
*
|
|
7
|
+
* @template | {@linkcode Fn} `T` - Expected function type.
|
|
8
|
+
*
|
|
9
|
+
* @param args - Options object.
|
|
10
|
+
* @param args.path - Submodule path to import from.
|
|
11
|
+
* @param args.fn - Named export function name.
|
|
12
|
+
*/
|
|
4
13
|
const helperFn = async ({ path, fn }) => {
|
|
5
14
|
const _fn = await customImport({
|
|
6
15
|
path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","names":[],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\nexport type Helper_F = (args: {\n path?: string;\n fn: string;\n}) => Promise<void>;\n\nexport const helperFn = async <T extends Fn = Fn>({\n path,\n fn,\n}: {\n path?: string;\n fn: string;\n}) => {\n const _fn = await customImport<T>({ path, fn: m => m[fn] });\n expect(_fn).toBeDefined();\n expect(_fn).toBeTypeOf('function');\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.js","names":[],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\n/**\n * Helper function type for verifying exported functions.\n */\nexport type Helper_F = (args: {\n path?: string;\n fn: string;\n}) => Promise<void>;\n\n/**\n * Asserts that a specified function is defined and exported from a module.\n *\n * @template | {@linkcode Fn} `T` - Expected function type.\n *\n * @param args - Options object.\n * @param args.path - Submodule path to import from.\n * @param args.fn - Named export function name.\n */\nexport const helperFn = async <T extends Fn = Fn>({\n path,\n fn,\n}: {\n path?: string;\n fn: string;\n}) => {\n const _fn = await customImport<T>({ path, fn: m => m[fn] });\n expect(_fn).toBeDefined();\n expect(_fn).toBeTypeOf('function');\n};\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,WAAW,OAA0B,EAChD,MACA,SAII;CACJ,MAAM,MAAM,MAAM,aAAgB;EAAE;EAAM,KAAI,MAAK,EAAE;CAAI,CAAC;CAC1D,OAAO,GAAG,CAAC,CAAC,YAAY;CACxB,OAAO,GAAG,CAAC,CAAC,WAAW,UAAU;AACnC"}
|
package/lib/build-tests/pack.cjs
CHANGED
|
@@ -8,9 +8,15 @@ let fs_promises = require("fs/promises");
|
|
|
8
8
|
let shelljs = require("shelljs");
|
|
9
9
|
shelljs = require_runtime.__toESM(shelljs, 1);
|
|
10
10
|
//#region src/build-tests/pack.ts
|
|
11
|
+
/**
|
|
12
|
+
* Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.
|
|
13
|
+
*
|
|
14
|
+
* @returns Promise resolving to the relative path of the created tarball.
|
|
15
|
+
*/
|
|
11
16
|
const pack = async () => {
|
|
12
17
|
const { packageJson, outDir } = require_build_tests_buildPackageJson.buildPackageJson();
|
|
13
|
-
|
|
18
|
+
const fileToWrite = `./${(0, path.join)(outDir, require_build_tests_constants.PACKAGE_PATH)}`;
|
|
19
|
+
await (0, fs_promises.writeFile)(fileToWrite, JSON.stringify(packageJson, null, 2));
|
|
14
20
|
const folderTocreate = `./${require_build_tests_constants.TARBALL_FOLDER}`;
|
|
15
21
|
shelljs.default.rm("-Rf", [folderTocreate]);
|
|
16
22
|
shelljs.default.mkdir(folderTocreate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.cjs","names":["buildPackageJson","PACKAGE_PATH","TARBALL_FOLDER","sh","getRelativePath0"],"sources":["../../src/build-tests/pack.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport sh from 'shelljs';\n\nimport type { Fn } from '#utils/types';\n\nimport { buildPackageJson } from './buildPackageJson';\nimport { DOT, PACKAGE_PATH, TARBALL_FOLDER } from './constants';\nimport { getRelativePath0 } from './getRelativePath';\n\ntype Pack_F = Fn<[], Promise<string>>;\n\nexport const pack: Pack_F = async () => {\n const { packageJson, outDir } = buildPackageJson();\n\n const fileToWrite = `${DOT}${join(outDir, PACKAGE_PATH)}`;\n\n await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));\n const folderTocreate = `${DOT}${TARBALL_FOLDER}`;\n sh.rm('-Rf', [folderTocreate]);\n sh.mkdir(folderTocreate);\n\n sh.cd(`${DOT}${outDir}`);\n\n const out1 = sh\n .exec(`pnpm pack --pack-destination ../${TARBALL_FOLDER}`)\n .toString();\n\n sh.cd('..');\n const out2 = getRelativePath0(out1);\n return out2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack.cjs","names":["buildPackageJson","join","PACKAGE_PATH","writeFile","TARBALL_FOLDER","sh","getRelativePath0"],"sources":["../../src/build-tests/pack.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport sh from 'shelljs';\n\nimport type { Fn } from '#utils/types';\n\nimport { buildPackageJson } from './buildPackageJson';\nimport { DOT, PACKAGE_PATH, TARBALL_FOLDER } from './constants';\nimport { getRelativePath0 } from './getRelativePath';\n\ntype Pack_F = Fn<[], Promise<string>>;\n\n/**\n * Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.\n *\n * @returns Promise resolving to the relative path of the created tarball.\n */\nexport const pack: Pack_F = async () => {\n const { packageJson, outDir } = buildPackageJson();\n\n const fileToWrite = `${DOT}${join(outDir, PACKAGE_PATH)}`;\n\n await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));\n const folderTocreate = `${DOT}${TARBALL_FOLDER}`;\n sh.rm('-Rf', [folderTocreate]);\n sh.mkdir(folderTocreate);\n\n sh.cd(`${DOT}${outDir}`);\n\n const out1 = sh\n .exec(`pnpm pack --pack-destination ../${TARBALL_FOLDER}`)\n .toString();\n\n sh.cd('..');\n const out2 = getRelativePath0(out1);\n return out2;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,OAAe,YAAY;CACtC,MAAM,EAAE,aAAa,WAAWA,qCAAAA,iBAAiB;CAEjD,MAAM,cAAc,MAAA,GAASC,KAAAA,KAAAA,CAAK,QAAQC,8BAAAA,YAAY;CAEtD,OAAA,GAAMC,YAAAA,UAAAA,CAAU,aAAa,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;CACjE,MAAM,iBAAiB,KAASC,8BAAAA;CAChC,QAAA,QAAG,GAAG,OAAO,CAAC,cAAc,CAAC;CAC7B,QAAA,QAAG,MAAM,cAAc;CAEvB,QAAA,QAAG,GAAG,KAAS,QAAQ;CAEvB,MAAM,OAAOC,QAAAA,QACV,KAAK,mCAAmCD,8BAAAA,gBAAgB,CAAC,CACzD,SAAS;CAEZ,QAAA,QAAG,GAAG,IAAI;CAEV,OADaE,oCAAAA,iBAAiB,IACpB;AACZ"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Fn } from '../utils/types';
|
|
2
2
|
type Pack_F = Fn<[], Promise<string>>;
|
|
3
|
+
/**
|
|
4
|
+
* Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.
|
|
5
|
+
*
|
|
6
|
+
* @returns Promise resolving to the relative path of the created tarball.
|
|
7
|
+
*/
|
|
3
8
|
export declare const pack: Pack_F;
|
|
4
9
|
export {};
|
package/lib/build-tests/pack.js
CHANGED
|
@@ -5,9 +5,15 @@ import { join } from "path";
|
|
|
5
5
|
import { writeFile } from "fs/promises";
|
|
6
6
|
import sh from "shelljs";
|
|
7
7
|
//#region src/build-tests/pack.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.
|
|
10
|
+
*
|
|
11
|
+
* @returns Promise resolving to the relative path of the created tarball.
|
|
12
|
+
*/
|
|
8
13
|
const pack = async () => {
|
|
9
14
|
const { packageJson, outDir } = buildPackageJson();
|
|
10
|
-
|
|
15
|
+
const fileToWrite = `./${join(outDir, PACKAGE_PATH)}`;
|
|
16
|
+
await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));
|
|
11
17
|
const folderTocreate = `./${TARBALL_FOLDER}`;
|
|
12
18
|
sh.rm("-Rf", [folderTocreate]);
|
|
13
19
|
sh.mkdir(folderTocreate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.js","names":[],"sources":["../../src/build-tests/pack.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport sh from 'shelljs';\n\nimport type { Fn } from '#utils/types';\n\nimport { buildPackageJson } from './buildPackageJson';\nimport { DOT, PACKAGE_PATH, TARBALL_FOLDER } from './constants';\nimport { getRelativePath0 } from './getRelativePath';\n\ntype Pack_F = Fn<[], Promise<string>>;\n\nexport const pack: Pack_F = async () => {\n const { packageJson, outDir } = buildPackageJson();\n\n const fileToWrite = `${DOT}${join(outDir, PACKAGE_PATH)}`;\n\n await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));\n const folderTocreate = `${DOT}${TARBALL_FOLDER}`;\n sh.rm('-Rf', [folderTocreate]);\n sh.mkdir(folderTocreate);\n\n sh.cd(`${DOT}${outDir}`);\n\n const out1 = sh\n .exec(`pnpm pack --pack-destination ../${TARBALL_FOLDER}`)\n .toString();\n\n sh.cd('..');\n const out2 = getRelativePath0(out1);\n return out2;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack.js","names":[],"sources":["../../src/build-tests/pack.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport sh from 'shelljs';\n\nimport type { Fn } from '#utils/types';\n\nimport { buildPackageJson } from './buildPackageJson';\nimport { DOT, PACKAGE_PATH, TARBALL_FOLDER } from './constants';\nimport { getRelativePath0 } from './getRelativePath';\n\ntype Pack_F = Fn<[], Promise<string>>;\n\n/**\n * Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.\n *\n * @returns Promise resolving to the relative path of the created tarball.\n */\nexport const pack: Pack_F = async () => {\n const { packageJson, outDir } = buildPackageJson();\n\n const fileToWrite = `${DOT}${join(outDir, PACKAGE_PATH)}`;\n\n await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));\n const folderTocreate = `${DOT}${TARBALL_FOLDER}`;\n sh.rm('-Rf', [folderTocreate]);\n sh.mkdir(folderTocreate);\n\n sh.cd(`${DOT}${outDir}`);\n\n const out1 = sh\n .exec(`pnpm pack --pack-destination ../${TARBALL_FOLDER}`)\n .toString();\n\n sh.cd('..');\n const out2 = getRelativePath0(out1);\n return out2;\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,OAAe,YAAY;CACtC,MAAM,EAAE,aAAa,WAAW,iBAAiB;CAEjD,MAAM,cAAc,KAAS,KAAK,QAAQ,YAAY;CAEtD,MAAM,UAAU,aAAa,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;CACjE,MAAM,iBAAiB,KAAS;CAChC,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;CAC7B,GAAG,MAAM,cAAc;CAEvB,GAAG,GAAG,KAAS,QAAQ;CAEvB,MAAM,OAAO,GACV,KAAK,mCAAmC,gBAAgB,CAAC,CACzD,SAAS;CAEZ,GAAG,GAAG,IAAI;CAEV,OADa,iBAAiB,IACpB;AACZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './suppressWarnings';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/plugins/suppressWarnings.ts
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin to filter out noisy terminal stdout/stderr warnings emitted
|
|
5
|
+
* by Nitro, SSR workers, or third-party dependencies during dev.
|
|
6
|
+
*
|
|
7
|
+
* @param patterns - Array of type {@linkcode string} or type
|
|
8
|
+
* {@linkcode RegExp} patterns to match against `stderr` chunks to
|
|
9
|
+
* suppress.
|
|
10
|
+
*
|
|
11
|
+
* @returns A Vite plugin object of type {@linkcode Plugin}.
|
|
12
|
+
*/
|
|
13
|
+
function suppressWarnings(...patterns) {
|
|
14
|
+
let isInitialized = false;
|
|
15
|
+
const shouldSuppress = (chunk) => {
|
|
16
|
+
const str = typeof chunk === "string" ? chunk : chunk?.toString?.() || "";
|
|
17
|
+
return patterns.some((pattern) => typeof pattern === "string" ? str.includes(pattern) : pattern.test(str));
|
|
18
|
+
};
|
|
19
|
+
const initFilter = () => {
|
|
20
|
+
if (isInitialized) return;
|
|
21
|
+
isInitialized = true;
|
|
22
|
+
const origStderrWrite = process.stderr.write.bind(process.stderr);
|
|
23
|
+
process.stderr.write = ((chunk, ...args) => {
|
|
24
|
+
if (shouldSuppress(chunk)) return true;
|
|
25
|
+
return origStderrWrite(chunk, ...args);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
initFilter();
|
|
29
|
+
return {
|
|
30
|
+
name: "suppress-logs-plugin",
|
|
31
|
+
apply: "serve"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.suppressWarnings = suppressWarnings;
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=suppressWarnings.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressWarnings.cjs","names":[],"sources":["../../src/plugins/suppressWarnings.ts"],"sourcesContent":["import { type Plugin } from 'vitest/config';\n\n/**\n * Vite plugin to filter out noisy terminal stdout/stderr warnings emitted\n * by Nitro, SSR workers, or third-party dependencies during dev.\n *\n * @param patterns - Array of type {@linkcode string} or type\n * {@linkcode RegExp} patterns to match against `stderr` chunks to\n * suppress.\n *\n * @returns A Vite plugin object of type {@linkcode Plugin}.\n */\nexport function suppressWarnings(\n ...patterns: Array<string | RegExp>\n): Plugin {\n let isInitialized = false;\n\n const shouldSuppress = (chunk: unknown): boolean => {\n const str =\n typeof chunk === 'string'\n ? chunk\n : (chunk as any)?.toString?.() || '';\n return patterns.some(pattern =>\n typeof pattern === 'string'\n ? str.includes(pattern)\n : pattern.test(str),\n );\n };\n\n const initFilter = () => {\n if (isInitialized) return;\n isInitialized = true;\n\n const origStderrWrite = process.stderr.write.bind(process.stderr);\n process.stderr.write = ((chunk: any, ...args: any[]) => {\n if (shouldSuppress(chunk)) return true;\n return (origStderrWrite as any)(chunk, ...args);\n }) as any;\n };\n\n // Initialize immediately on plugin registration\n initFilter();\n\n return {\n name: 'suppress-logs-plugin',\n apply: 'serve', // Runs only during dev\n };\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,iBACd,GAAG,UACK;CACR,IAAI,gBAAgB;CAEpB,MAAM,kBAAkB,UAA4B;EAClD,MAAM,MACJ,OAAO,UAAU,WACb,QACC,OAAe,WAAW,KAAK;EACtC,OAAO,SAAS,MAAK,YACnB,OAAO,YAAY,WACf,IAAI,SAAS,OAAO,IACpB,QAAQ,KAAK,GAAG,CACtB;CACF;CAEA,MAAM,mBAAmB;EACvB,IAAI,eAAe;EACnB,gBAAgB;EAEhB,MAAM,kBAAkB,QAAQ,OAAO,MAAM,KAAK,QAAQ,MAAM;EAChE,QAAQ,OAAO,UAAU,OAAY,GAAG,SAAgB;GACtD,IAAI,eAAe,KAAK,GAAG,OAAO;GAClC,OAAQ,gBAAwB,OAAO,GAAG,IAAI;EAChD;CACF;CAGA,WAAW;CAEX,OAAO;EACL,MAAM;EACN,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Plugin } from 'vitest/config';
|
|
2
|
+
/**
|
|
3
|
+
* Vite plugin to filter out noisy terminal stdout/stderr warnings emitted
|
|
4
|
+
* by Nitro, SSR workers, or third-party dependencies during dev.
|
|
5
|
+
*
|
|
6
|
+
* @param patterns - Array of type {@linkcode string} or type
|
|
7
|
+
* {@linkcode RegExp} patterns to match against `stderr` chunks to
|
|
8
|
+
* suppress.
|
|
9
|
+
*
|
|
10
|
+
* @returns A Vite plugin object of type {@linkcode Plugin}.
|
|
11
|
+
*/
|
|
12
|
+
export declare function suppressWarnings(...patterns: Array<string | RegExp>): Plugin;
|