@bemedev/dev-utils 1.5.0 → 1.5.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/README.md +83 -12
- package/lib/_virtual/_rolldown/runtime.cjs +1 -2
- package/lib/build-tests/addTarball.cjs +8 -3
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.d.ts +7 -1
- package/lib/build-tests/addTarball.js +8 -3
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs +9 -4
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +14 -2
- package/lib/build-tests/buildPackageJson.js +9 -4
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs +5 -3
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.d.ts +4 -1
- package/lib/build-tests/cleanup.js +5 -3
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +6 -4
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.d.ts +3 -0
- package/lib/build-tests/cli/cli.js +6 -4
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs +1 -2
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/index.js +1 -2
- package/lib/build-tests/cli/post.cjs +5 -3
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.d.ts +4 -1
- package/lib/build-tests/cli/post.js +5 -3
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +5 -3
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.d.ts +4 -1
- package/lib/build-tests/cli/pre.js +5 -3
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs +4 -2
- 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 +4 -2
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs +1 -2
- package/lib/build-tests/constants.js +1 -2
- package/lib/build-tests/getRelativePath.cjs +1 -2
- package/lib/build-tests/getRelativePath.d.ts +1 -1
- package/lib/build-tests/getRelativePath.js +1 -2
- package/lib/build-tests/getTypescriptOutdir.cjs +1 -2
- package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
- package/lib/build-tests/getTypescriptOutdir.js +1 -2
- package/lib/build-tests/import.cjs +1 -2
- package/lib/build-tests/import.js +1 -2
- package/lib/build-tests/imports/create.cjs +1 -2
- package/lib/build-tests/imports/create.js +1 -2
- package/lib/build-tests/imports/helper.cjs +1 -2
- package/lib/build-tests/imports/helper.js +1 -2
- package/lib/build-tests/imports/index.js +1 -2
- package/lib/build-tests/index.cjs +1 -1
- package/lib/build-tests/index.js +1 -1
- package/lib/build-tests/pack.cjs +2 -3
- package/lib/build-tests/pack.d.ts +1 -1
- package/lib/build-tests/pack.js +2 -3
- package/lib/pack/config.cjs +103 -0
- package/lib/pack/config.cjs.map +1 -0
- package/lib/pack/config.d.ts +21 -0
- package/lib/pack/config.js +102 -0
- package/lib/pack/config.js.map +1 -0
- package/lib/pack/constants.cjs +45 -0
- package/lib/pack/constants.cjs.map +1 -0
- package/lib/pack/constants.d.ts +23 -0
- package/lib/pack/constants.js +40 -0
- package/lib/pack/constants.js.map +1 -0
- package/lib/pack/index.cjs +17 -0
- package/lib/pack/index.d.ts +6 -0
- package/lib/pack/index.js +6 -0
- package/lib/pack/input.cjs +19 -0
- package/lib/pack/input.cjs.map +1 -0
- package/lib/pack/input.d.ts +10 -0
- package/lib/pack/input.js +18 -0
- package/lib/pack/input.js.map +1 -0
- package/lib/pack/output.cjs +26 -0
- package/lib/pack/output.cjs.map +1 -0
- package/lib/pack/output.d.ts +13 -0
- package/lib/pack/output.js +25 -0
- package/lib/pack/output.js.map +1 -0
- package/lib/pack/plugins/circulars.cjs +39 -0
- package/lib/pack/plugins/circulars.cjs.map +1 -0
- package/lib/pack/plugins/circulars.d.ts +18 -0
- package/lib/pack/plugins/circulars.js +38 -0
- package/lib/pack/plugins/circulars.js.map +1 -0
- package/lib/pack/plugins/index.cjs +22 -0
- package/lib/pack/plugins/index.cjs.map +1 -0
- package/lib/pack/plugins/index.d.ts +25 -0
- package/lib/pack/plugins/index.js +21 -0
- package/lib/pack/plugins/index.js.map +1 -0
- package/lib/pack/project.cjs +32 -0
- package/lib/pack/project.cjs.map +1 -0
- package/lib/pack/project.d.ts +9 -0
- package/lib/pack/project.js +31 -0
- package/lib/pack/project.js.map +1 -0
- package/lib/pack/types.d.ts +46 -0
- package/lib/plugins/hmr.cjs +3 -4
- package/lib/plugins/hmr.cjs.map +1 -1
- package/lib/plugins/hmr.d.ts +1 -1
- package/lib/plugins/hmr.js +2 -3
- package/lib/plugins/suppressWarnings.cjs +1 -2
- package/lib/plugins/suppressWarnings.js +1 -2
- package/lib/rolldown-config/config.cjs +3 -4
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.js +3 -4
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs +1 -2
- package/lib/rolldown-config/constants.js +1 -2
- package/lib/rolldown-config/helpers.cjs +1 -2
- package/lib/rolldown-config/helpers.js +1 -2
- package/lib/rolldown-config/index.cjs +1 -1
- package/lib/rolldown-config/index.js +1 -1
- package/lib/rolldown-config/input.cjs +1 -2
- package/lib/rolldown-config/input.js +1 -2
- package/lib/rolldown-config/output.cjs +1 -2
- package/lib/rolldown-config/output.js +1 -2
- package/lib/rolldown-config/plugins/circulars.cjs +1 -2
- package/lib/rolldown-config/plugins/circulars.js +1 -2
- package/lib/rolldown-config/plugins/clean.cjs +2 -3
- package/lib/rolldown-config/plugins/clean.js +2 -3
- package/lib/rolldown-config/plugins/externals.cjs +1 -2
- package/lib/rolldown-config/plugins/externals.js +1 -2
- package/lib/rolldown-config/plugins/index.cjs +1 -2
- package/lib/rolldown-config/plugins/index.js +1 -2
- package/lib/rolldown-config/plugins/typescript.cjs +1 -2
- package/lib/rolldown-config/plugins/typescript.config.cjs +1 -2
- package/lib/rolldown-config/plugins/typescript.config.js +1 -2
- package/lib/rolldown-config/plugins/typescript.fast.cjs +1 -2
- package/lib/rolldown-config/plugins/typescript.fast.js +1 -2
- package/lib/rolldown-config/plugins/typescript.js +1 -2
- package/lib/utils/array.cjs +1 -2
- package/lib/utils/array.js +1 -2
- package/lib/utils/bemedev/globals/types.d.ts +1 -0
- package/lib/utils/bemedev/globals/utils/_unknown.cjs +1 -2
- package/lib/utils/bemedev/globals/utils/_unknown.js +1 -2
- package/lib/utils/bemedev/globals/utils/expandFn.cjs +1 -2
- package/lib/utils/bemedev/globals/utils/expandFn.js +1 -2
- package/lib/utils/clamp.cjs +1 -2
- package/lib/utils/clamp.js +1 -2
- package/lib/utils/identity.cjs +1 -2
- package/lib/utils/identity.js +1 -2
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/sleep.cjs +1 -2
- package/lib/utils/sleep.js +1 -2
- package/lib/utils/types.d.ts +1 -1
- package/lib/vitest-exclude/constants.cjs +1 -2
- package/lib/vitest-exclude/constants.js +1 -2
- package/lib/vitest-exclude/index.js +1 -2
- package/lib/vitest-exclude/vitest.cjs +2 -3
- package/lib/vitest-exclude/vitest.js +2 -3
- package/lib/vitest-exclude/vitest.utils.cjs +1 -2
- package/lib/vitest-exclude/vitest.utils.js +1 -2
- package/lib/vitest-extended/acceptation.cjs +1 -2
- package/lib/vitest-extended/acceptation.js +1 -2
- package/lib/vitest-extended/createTests.cjs +2 -3
- package/lib/vitest-extended/createTests.js +2 -3
- package/lib/vitest-extended/done.cjs +1 -2
- package/lib/vitest-extended/done.js +1 -2
- package/lib/vitest-extended/each/error.cjs +2 -3
- package/lib/vitest-extended/each/error.js +2 -3
- package/lib/vitest-extended/each/pass.cjs +2 -3
- package/lib/vitest-extended/each/pass.js +2 -3
- package/lib/vitest-extended/fakeWaiter.cjs +1 -2
- package/lib/vitest-extended/fakeWaiter.js +1 -2
- package/lib/vitest-extended/fixtures/coverage.cjs +1 -2
- package/lib/vitest-extended/fixtures/coverage.js +1 -2
- package/lib/vitest-extended/fixtures/partialCall.cjs +1 -2
- package/lib/vitest-extended/fixtures/partialCall.js +1 -2
- package/lib/vitest-extended/fixtures/toUpper.cjs +1 -2
- package/lib/vitest-extended/fixtures/toUpper.js +1 -2
- package/lib/vitest-extended/fixtures/vitest.cjs +1 -2
- package/lib/vitest-extended/fixtures/vitest.js +1 -2
- package/lib/vitest-extended/fixtures/zod.cjs +1 -2
- package/lib/vitest-extended/fixtures/zod.js +1 -2
- package/lib/vitest-extended/identity.cjs +1 -2
- package/lib/vitest-extended/identity.js +1 -2
- package/lib/vitest-extended/index.cjs +2 -2
- package/lib/vitest-extended/index.js +2 -2
- package/lib/vitest-extended/isDefined.cjs +1 -2
- package/lib/vitest-extended/isDefined.js +1 -2
- package/lib/vitest-extended/isFunction.cjs +1 -2
- package/lib/vitest-extended/isFunction.js +1 -2
- package/lib/vitest-extended/project.cjs +9 -7
- package/lib/vitest-extended/project.cjs.map +1 -1
- package/lib/vitest-extended/project.d.ts +2 -2
- package/lib/vitest-extended/project.js +10 -8
- package/lib/vitest-extended/project.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs +1 -2
- package/lib/vitest-extended/toArray.js +1 -2
- package/lib/vitest-extended/toStringFlat.cjs +1 -2
- package/lib/vitest-extended/toStringFlat.js +1 -2
- package/package.json +68 -59
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_build_tests_addTarball = require("../addTarball.cjs");
|
|
3
|
-
|
|
3
|
+
// src/build-tests/cli/pre.ts
|
|
4
4
|
/**
|
|
5
|
-
* CLI command to prepare tests by building and installing the local tarball
|
|
5
|
+
* CLI command to prepare tests by building and installing the local tarball
|
|
6
|
+
* package.
|
|
7
|
+
*
|
|
8
|
+
* Delegates to {@linkcode addTarball}.
|
|
6
9
|
*/
|
|
7
10
|
const pretest = (0, require("cmd-ts").command)({
|
|
8
11
|
name: "pretest",
|
|
@@ -14,7 +17,6 @@ const pretest = (0, require("cmd-ts").command)({
|
|
|
14
17
|
args: {},
|
|
15
18
|
handler: require_build_tests_addTarball.addTarball
|
|
16
19
|
});
|
|
17
|
-
//#endregion
|
|
18
20
|
exports.pretest = pretest;
|
|
19
21
|
|
|
20
22
|
//# sourceMappingURL=pre.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre.cjs","names":["command","addTarball"],"sources":["../../../src/build-tests/cli/pre.ts"],"sourcesContent":["import { command } from 'cmd-ts';\n\nimport { addTarball } from '../addTarball';\n\n/**\n * CLI command to prepare tests by building and installing the local tarball package.\n */\nexport const pretest = command({\n name: 'pretest',\n aliases: ['pre:test', 'pre', 'pre-test'],\n args: {},\n handler: addTarball,\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pre.cjs","names":["command","addTarball"],"sources":["../../../src/build-tests/cli/pre.ts"],"sourcesContent":["import { command } from 'cmd-ts';\n\nimport { addTarball } from '../addTarball';\n\n/**\n * CLI command to prepare tests by building and installing the local tarball\n * package.\n *\n * Delegates to {@linkcode addTarball}.\n */\nexport const pretest = command({\n name: 'pretest',\n aliases: ['pre:test', 'pre', 'pre-test'],\n args: {},\n handler: addTarball,\n});\n"],"mappings":";;;;;;;;;AAUA,MAAa,WAAA,G,gBAAUA,CAAAA,CAAAA,QAAAA,CAAQ;CAC7B,MAAM;CACN,SAAS;EAAC;EAAY;EAAO;CAAU;CACvC,MAAM,CAAC;CACP,SAASC,+BAAAA;AACX,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CLI command to prepare tests by building and installing the local tarball
|
|
2
|
+
* CLI command to prepare tests by building and installing the local tarball
|
|
3
|
+
* package.
|
|
4
|
+
*
|
|
5
|
+
* Delegates to {@linkcode addTarball}.
|
|
3
6
|
*/
|
|
4
7
|
export declare const pretest: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
5
8
|
parse(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{}>>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { addTarball } from "../addTarball.js";
|
|
2
2
|
import { command } from "cmd-ts";
|
|
3
|
-
|
|
3
|
+
// src/build-tests/cli/pre.ts
|
|
4
4
|
/**
|
|
5
|
-
* CLI command to prepare tests by building and installing the local tarball
|
|
5
|
+
* CLI command to prepare tests by building and installing the local tarball
|
|
6
|
+
* package.
|
|
7
|
+
*
|
|
8
|
+
* Delegates to {@linkcode addTarball}.
|
|
6
9
|
*/
|
|
7
10
|
const pretest = command({
|
|
8
11
|
name: "pretest",
|
|
@@ -14,7 +17,6 @@ const pretest = command({
|
|
|
14
17
|
args: {},
|
|
15
18
|
handler: addTarball
|
|
16
19
|
});
|
|
17
|
-
//#endregion
|
|
18
20
|
export { pretest };
|
|
19
21
|
|
|
20
22
|
//# sourceMappingURL=pre.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre.js","names":[],"sources":["../../../src/build-tests/cli/pre.ts"],"sourcesContent":["import { command } from 'cmd-ts';\n\nimport { addTarball } from '../addTarball';\n\n/**\n * CLI command to prepare tests by building and installing the local tarball package.\n */\nexport const pretest = command({\n name: 'pretest',\n aliases: ['pre:test', 'pre', 'pre-test'],\n args: {},\n handler: addTarball,\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pre.js","names":[],"sources":["../../../src/build-tests/cli/pre.ts"],"sourcesContent":["import { command } from 'cmd-ts';\n\nimport { addTarball } from '../addTarball';\n\n/**\n * CLI command to prepare tests by building and installing the local tarball\n * package.\n *\n * Delegates to {@linkcode addTarball}.\n */\nexport const pretest = command({\n name: 'pretest',\n aliases: ['pre:test', 'pre', 'pre-test'],\n args: {},\n handler: addTarball,\n});\n"],"mappings":";;;;;;;;;AAUA,MAAa,UAAU,QAAQ;CAC7B,MAAM;CACN,SAAS;EAAC;EAAY;EAAO;CAAU;CACvC,MAAM,CAAC;CACP,SAAS;AACX,CAAC"}
|
|
@@ -5,9 +5,12 @@ const require_build_tests_cleanup = require("../cleanup.cjs");
|
|
|
5
5
|
let shelljs = require("shelljs");
|
|
6
6
|
shelljs = require_runtime.__toESM(shelljs, 1);
|
|
7
7
|
let cmd_ts = require("cmd-ts");
|
|
8
|
-
|
|
8
|
+
// src/build-tests/cli/test.ts
|
|
9
9
|
/**
|
|
10
10
|
* CLI command to execute tests with optional lifecycle hooks (pre/post).
|
|
11
|
+
*
|
|
12
|
+
* The hooks delegate to {@linkcode addTarball} for preparation and
|
|
13
|
+
* {@linkcode cleanup} for teardown.
|
|
11
14
|
*/
|
|
12
15
|
const test = (0, cmd_ts.command)({
|
|
13
16
|
name: "test",
|
|
@@ -39,7 +42,6 @@ const test = (0, cmd_ts.command)({
|
|
|
39
42
|
if (posttest || post) require_build_tests_cleanup.cleanup();
|
|
40
43
|
}
|
|
41
44
|
});
|
|
42
|
-
//#endregion
|
|
43
45
|
exports.test = test;
|
|
44
46
|
|
|
45
47
|
//# sourceMappingURL=test.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.cjs","names":["command","flag","addTarball","sh"],"sources":["../../../src/build-tests/cli/test.ts"],"sourcesContent":["import { command, flag } from 'cmd-ts';\nimport sh from 'shelljs';\n\nimport { addTarball } from '../addTarball';\nimport { cleanup } from '../cleanup';\n\n/**\n * CLI command to execute tests with optional lifecycle hooks (pre/post).\n */\nexport const test = command({\n name: 'test',\n\n args: {\n pretest: flag({ description: 'The hook pretest', short: 'b', long: 'pretest' }),\n\n posttest: flag({\n description: 'The hook posttest',\n short: 'a',\n long: 'posttest',\n }),\n\n pre: flag({ description: 'The hook pretest', long: 'pre' }),\n\n post: flag({ description: 'The hook posttest', long: 'post' }),\n },\n\n // Ignores coverage because of recursivity\n /* v8 ignore next 11 */\n handler: async ({ pretest, posttest, pre, post }) => {\n if (pretest || pre) await addTarball();\n\n // #region Test\n const { stderr } = sh.exec('pnpm run test');\n if (!!stderr && stderr.trim() !== '') console.warn(stderr);\n // #endregion\n\n if (posttest || post) cleanup();\n },\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.cjs","names":["command","flag","addTarball","sh"],"sources":["../../../src/build-tests/cli/test.ts"],"sourcesContent":["import { command, flag } from 'cmd-ts';\nimport sh from 'shelljs';\n\nimport { addTarball } from '../addTarball';\nimport { cleanup } from '../cleanup';\n\n/**\n * CLI command to execute tests with optional lifecycle hooks (pre/post).\n *\n * The hooks delegate to {@linkcode addTarball} for preparation and\n * {@linkcode cleanup} for teardown.\n */\nexport const test = command({\n name: 'test',\n\n args: {\n pretest: flag({ description: 'The hook pretest', short: 'b', long: 'pretest' }),\n\n posttest: flag({\n description: 'The hook posttest',\n short: 'a',\n long: 'posttest',\n }),\n\n pre: flag({ description: 'The hook pretest', long: 'pre' }),\n\n post: flag({ description: 'The hook posttest', long: 'post' }),\n },\n\n // Ignores coverage because of recursivity\n /* v8 ignore next 11 */\n handler: async ({ pretest, posttest, pre, post }) => {\n if (pretest || pre) await addTarball();\n\n // #region Test\n const { stderr } = sh.exec('pnpm run test');\n if (!!stderr && stderr.trim() !== '') console.warn(stderr);\n // #endregion\n\n if (posttest || post) cleanup();\n },\n});\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,QAAA,GAAOA,OAAAA,QAAAA,CAAQ;CAC1B,MAAM;CAEN,MAAM;EACJ,UAAA,GAASC,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAoB,OAAO;GAAK,MAAM;EAAU,CAAC;EAE9E,WAAA,GAAUA,OAAAA,KAAAA,CAAK;GACb,aAAa;GACb,OAAO;GACP,MAAM;EACR,CAAC;EAED,MAAA,GAAKA,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAoB,MAAM;EAAM,CAAC;EAE1D,OAAA,GAAMA,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAqB,MAAM;EAAO,CAAC;CAC/D;;CAIA,SAAS,OAAO,EAAE,SAAS,UAAU,KAAK,WAAW;EACnD,IAAI,WAAW,KAAK,MAAMC,+BAAAA,WAAW;EAGrC,MAAM,EAAE,WAAWC,QAAAA,QAAG,KAAK,eAAe;EAC1C,IAAI,CAAC,CAAC,UAAU,OAAO,KAAK,MAAM,IAAI,QAAQ,KAAK,MAAM;EAGzD,IAAI,YAAY,MAAM,4BAAA,QAAQ;CAChC;AACF,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI command to execute tests with optional lifecycle hooks (pre/post).
|
|
3
|
+
*
|
|
4
|
+
* The hooks delegate to {@linkcode addTarball} for preparation and
|
|
5
|
+
* {@linkcode cleanup} for teardown.
|
|
3
6
|
*/
|
|
4
7
|
export declare const test: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
5
8
|
parse(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{
|
|
@@ -2,9 +2,12 @@ import { addTarball } from "../addTarball.js";
|
|
|
2
2
|
import { cleanup } from "../cleanup.js";
|
|
3
3
|
import sh from "shelljs";
|
|
4
4
|
import { command, flag } from "cmd-ts";
|
|
5
|
-
|
|
5
|
+
// src/build-tests/cli/test.ts
|
|
6
6
|
/**
|
|
7
7
|
* CLI command to execute tests with optional lifecycle hooks (pre/post).
|
|
8
|
+
*
|
|
9
|
+
* The hooks delegate to {@linkcode addTarball} for preparation and
|
|
10
|
+
* {@linkcode cleanup} for teardown.
|
|
8
11
|
*/
|
|
9
12
|
const test = command({
|
|
10
13
|
name: "test",
|
|
@@ -36,7 +39,6 @@ const test = command({
|
|
|
36
39
|
if (posttest || post) cleanup();
|
|
37
40
|
}
|
|
38
41
|
});
|
|
39
|
-
//#endregion
|
|
40
42
|
export { test };
|
|
41
43
|
|
|
42
44
|
//# sourceMappingURL=test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","names":[],"sources":["../../../src/build-tests/cli/test.ts"],"sourcesContent":["import { command, flag } from 'cmd-ts';\nimport sh from 'shelljs';\n\nimport { addTarball } from '../addTarball';\nimport { cleanup } from '../cleanup';\n\n/**\n * CLI command to execute tests with optional lifecycle hooks (pre/post).\n */\nexport const test = command({\n name: 'test',\n\n args: {\n pretest: flag({ description: 'The hook pretest', short: 'b', long: 'pretest' }),\n\n posttest: flag({\n description: 'The hook posttest',\n short: 'a',\n long: 'posttest',\n }),\n\n pre: flag({ description: 'The hook pretest', long: 'pre' }),\n\n post: flag({ description: 'The hook posttest', long: 'post' }),\n },\n\n // Ignores coverage because of recursivity\n /* v8 ignore next 11 */\n handler: async ({ pretest, posttest, pre, post }) => {\n if (pretest || pre) await addTarball();\n\n // #region Test\n const { stderr } = sh.exec('pnpm run test');\n if (!!stderr && stderr.trim() !== '') console.warn(stderr);\n // #endregion\n\n if (posttest || post) cleanup();\n },\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.js","names":[],"sources":["../../../src/build-tests/cli/test.ts"],"sourcesContent":["import { command, flag } from 'cmd-ts';\nimport sh from 'shelljs';\n\nimport { addTarball } from '../addTarball';\nimport { cleanup } from '../cleanup';\n\n/**\n * CLI command to execute tests with optional lifecycle hooks (pre/post).\n *\n * The hooks delegate to {@linkcode addTarball} for preparation and\n * {@linkcode cleanup} for teardown.\n */\nexport const test = command({\n name: 'test',\n\n args: {\n pretest: flag({ description: 'The hook pretest', short: 'b', long: 'pretest' }),\n\n posttest: flag({\n description: 'The hook posttest',\n short: 'a',\n long: 'posttest',\n }),\n\n pre: flag({ description: 'The hook pretest', long: 'pre' }),\n\n post: flag({ description: 'The hook posttest', long: 'post' }),\n },\n\n // Ignores coverage because of recursivity\n /* v8 ignore next 11 */\n handler: async ({ pretest, posttest, pre, post }) => {\n if (pretest || pre) await addTarball();\n\n // #region Test\n const { stderr } = sh.exec('pnpm run test');\n if (!!stderr && stderr.trim() !== '') console.warn(stderr);\n // #endregion\n\n if (posttest || post) cleanup();\n },\n});\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,OAAO,QAAQ;CAC1B,MAAM;CAEN,MAAM;EACJ,SAAS,KAAK;GAAE,aAAa;GAAoB,OAAO;GAAK,MAAM;EAAU,CAAC;EAE9E,UAAU,KAAK;GACb,aAAa;GACb,OAAO;GACP,MAAM;EACR,CAAC;EAED,KAAK,KAAK;GAAE,aAAa;GAAoB,MAAM;EAAM,CAAC;EAE1D,MAAM,KAAK;GAAE,aAAa;GAAqB,MAAM;EAAO,CAAC;CAC/D;;CAIA,SAAS,OAAO,EAAE,SAAS,UAAU,KAAK,WAAW;EACnD,IAAI,WAAW,KAAK,MAAM,WAAW;EAGrC,MAAM,EAAE,WAAW,GAAG,KAAK,eAAe;EAC1C,IAAI,CAAC,CAAC,UAAU,OAAO,KAAK,MAAM,IAAI,QAAQ,KAAK,MAAM;EAGzD,IAAI,YAAY,MAAM,QAAQ;CAChC;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/build-tests/constants.ts
|
|
3
3
|
/**
|
|
4
4
|
* File scheme identifier prefix.
|
|
5
5
|
*/
|
|
@@ -60,7 +60,6 @@ const TEARDOWN_COMMAND = `pnpm remove ${THIS1}`;
|
|
|
60
60
|
* Default output directory relative path.
|
|
61
61
|
*/
|
|
62
62
|
const DEFAULT_OUT_DIR = "./lib";
|
|
63
|
-
//#endregion
|
|
64
63
|
exports.BIN_KEY = BIN_KEY;
|
|
65
64
|
exports.DEFAULT_OUT_DIR = DEFAULT_OUT_DIR;
|
|
66
65
|
exports.DOT = DOT;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/build-tests/constants.ts
|
|
2
2
|
/**
|
|
3
3
|
* File scheme identifier prefix.
|
|
4
4
|
*/
|
|
@@ -59,7 +59,6 @@ const TEARDOWN_COMMAND = `pnpm remove ${THIS1}`;
|
|
|
59
59
|
* Default output directory relative path.
|
|
60
60
|
*/
|
|
61
61
|
const DEFAULT_OUT_DIR = "./lib";
|
|
62
|
-
//#endregion
|
|
63
62
|
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 };
|
|
64
63
|
|
|
65
64
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
+
// src/build-tests/getRelativePath.ts
|
|
5
5
|
/**
|
|
6
6
|
* Extracts and computes the relative path to the generated tarball file from pack output.
|
|
7
7
|
*
|
|
@@ -13,7 +13,6 @@ const getRelativePath0 = (result) => {
|
|
|
13
13
|
const out1 = result.split("\n").find((val) => val.endsWith(require_build_tests_constants.TARBALL_EXTENSION));
|
|
14
14
|
return (0, path.relative)(process.cwd(), out1);
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
exports.getRelativePath0 = getRelativePath0;
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=getRelativePath.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TARBALL_EXTENSION } from "./constants.js";
|
|
2
2
|
import { relative } from "path";
|
|
3
|
-
|
|
3
|
+
// src/build-tests/getRelativePath.ts
|
|
4
4
|
/**
|
|
5
5
|
* Extracts and computes the relative path to the generated tarball file from pack output.
|
|
6
6
|
*
|
|
@@ -12,7 +12,6 @@ const getRelativePath0 = (result) => {
|
|
|
12
12
|
const out1 = result.split("\n").find((val) => val.endsWith(TARBALL_EXTENSION));
|
|
13
13
|
return relative(process.cwd(), out1);
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { getRelativePath0 };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=getRelativePath.js.map
|
|
@@ -4,7 +4,7 @@ const require_build_tests_constants = require("./constants.cjs");
|
|
|
4
4
|
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
|
+
// src/build-tests/getTypescriptOutdir.ts
|
|
8
8
|
/**
|
|
9
9
|
* Resolves the TypeScript output directory specified in `tsconfig.json`.
|
|
10
10
|
*
|
|
@@ -18,7 +18,6 @@ const getTypescriptOutdir = () => {
|
|
|
18
18
|
file = void 0;
|
|
19
19
|
return outDir2;
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
exports.getTypescriptOutdir = getTypescriptOutdir;
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=getTypescriptOutdir.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TS_PATH } from "./constants.js";
|
|
2
2
|
import { resolve } from "path";
|
|
3
3
|
import editJsonFile from "edit-json-file";
|
|
4
|
-
|
|
4
|
+
// src/build-tests/getTypescriptOutdir.ts
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the TypeScript output directory specified in `tsconfig.json`.
|
|
7
7
|
*
|
|
@@ -15,7 +15,6 @@ const getTypescriptOutdir = () => {
|
|
|
15
15
|
file = void 0;
|
|
16
16
|
return outDir2;
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { getTypescriptOutdir };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=getTypescriptOutdir.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
+
// src/build-tests/import.ts
|
|
5
5
|
/**
|
|
6
6
|
* Dynamically imports a module or submodule from the generated test package.
|
|
7
7
|
*
|
|
@@ -14,7 +14,6 @@ const require_build_tests_constants = require("./constants.cjs");
|
|
|
14
14
|
const customImport = async ({ path = "", fn = require_utils_identity.identity }) => {
|
|
15
15
|
return fn(await (path === "" ? import(require_build_tests_constants.THIS1) : import(`${require_build_tests_constants.THIS1}/${path}`)));
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
exports.customImport = customImport;
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=import.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { identity } from "../utils/identity.js";
|
|
2
2
|
import { THIS1 } from "./constants.js";
|
|
3
|
-
|
|
3
|
+
// src/build-tests/import.ts
|
|
4
4
|
/**
|
|
5
5
|
* Dynamically imports a module or submodule from the generated test package.
|
|
6
6
|
*
|
|
@@ -13,7 +13,6 @@ import { THIS1 } from "./constants.js";
|
|
|
13
13
|
const customImport = async ({ path = "", fn = identity }) => {
|
|
14
14
|
return fn(await (path === "" ? import(THIS1) : import(`${THIS1}/${path}`)));
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
export { customImport };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=import.js.map
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_vitest_extended_toStringFlat = require("../../vitest-extended/toStringFlat.cjs");
|
|
3
3
|
const require_build_tests_imports_helper = require("./helper.cjs");
|
|
4
4
|
let vitest = require("vitest");
|
|
5
|
-
|
|
5
|
+
// src/build-tests/imports/create.ts
|
|
6
6
|
/**
|
|
7
7
|
* Creates Vitest test suites verifying that symbols are properly exported from a module.
|
|
8
8
|
*
|
|
@@ -42,7 +42,6 @@ const createImportFnTests = (args) => {
|
|
|
42
42
|
};
|
|
43
43
|
return [invite, fn];
|
|
44
44
|
};
|
|
45
|
-
//#endregion
|
|
46
45
|
exports.createImportFnTests = createImportFnTests;
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=create.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toStringFlat } from "../../vitest-extended/toStringFlat.js";
|
|
2
2
|
import { helperFn } from "./helper.js";
|
|
3
3
|
import { describe, test } from "vitest";
|
|
4
|
-
|
|
4
|
+
// src/build-tests/imports/create.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates Vitest test suites verifying that symbols are properly exported from a module.
|
|
7
7
|
*
|
|
@@ -41,7 +41,6 @@ const createImportFnTests = (args) => {
|
|
|
41
41
|
};
|
|
42
42
|
return [invite, fn];
|
|
43
43
|
};
|
|
44
|
-
//#endregion
|
|
45
44
|
export { createImportFnTests };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=create.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
+
// src/build-tests/imports/helper.ts
|
|
5
5
|
/**
|
|
6
6
|
* Asserts that a specified function is defined and exported from a module.
|
|
7
7
|
*
|
|
@@ -19,7 +19,6 @@ const helperFn = async ({ path, fn }) => {
|
|
|
19
19
|
(0, vitest.expect)(_fn).toBeDefined();
|
|
20
20
|
(0, vitest.expect)(_fn).toBeTypeOf("function");
|
|
21
21
|
};
|
|
22
|
-
//#endregion
|
|
23
22
|
exports.helperFn = helperFn;
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=helper.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { customImport } from "../import.js";
|
|
2
2
|
import { expect } from "vitest";
|
|
3
|
-
|
|
3
|
+
// src/build-tests/imports/helper.ts
|
|
4
4
|
/**
|
|
5
5
|
* Asserts that a specified function is defined and exported from a module.
|
|
6
6
|
*
|
|
@@ -18,7 +18,6 @@ const helperFn = async ({ path, fn }) => {
|
|
|
18
18
|
expect(_fn).toBeDefined();
|
|
19
19
|
expect(_fn).toBeTypeOf("function");
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { helperFn };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createImportFnTests };
|
|
1
|
+
export { createImportFnTests } from "./create.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_build_tests_constants = require("./constants.cjs");
|
|
3
2
|
const require_build_tests_addTarball = require("./addTarball.cjs");
|
|
4
3
|
const require_build_tests_cleanup = require("./cleanup.cjs");
|
|
4
|
+
const require_build_tests_constants = require("./constants.cjs");
|
|
5
5
|
const require_build_tests_import = require("./import.cjs");
|
|
6
6
|
const require_build_tests_imports_create = require("./imports/create.cjs");
|
|
7
7
|
require("./imports/index.cjs");
|
package/lib/build-tests/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { THIS1 } from "./constants.js";
|
|
2
1
|
import { addTarball } from "./addTarball.js";
|
|
3
2
|
import { cleanup } from "./cleanup.js";
|
|
3
|
+
import { THIS1 } from "./constants.js";
|
|
4
4
|
import { customImport } from "./import.js";
|
|
5
5
|
import { createImportFnTests } from "./imports/create.js";
|
|
6
6
|
import "./imports/index.js";
|
package/lib/build-tests/pack.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
const require_build_tests_constants = require("./constants.cjs");
|
|
4
3
|
const require_build_tests_buildPackageJson = require("./buildPackageJson.cjs");
|
|
4
|
+
const require_build_tests_constants = require("./constants.cjs");
|
|
5
5
|
const require_build_tests_getRelativePath = require("./getRelativePath.cjs");
|
|
6
6
|
let path = require("path");
|
|
7
7
|
let fs_promises = require("fs/promises");
|
|
8
8
|
let shelljs = require("shelljs");
|
|
9
9
|
shelljs = require_runtime.__toESM(shelljs, 1);
|
|
10
|
-
|
|
10
|
+
// src/build-tests/pack.ts
|
|
11
11
|
/**
|
|
12
12
|
* Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.
|
|
13
13
|
*
|
|
@@ -25,7 +25,6 @@ const pack = async () => {
|
|
|
25
25
|
shelljs.default.cd("..");
|
|
26
26
|
return require_build_tests_getRelativePath.getRelativePath0(out1);
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
exports.pack = pack;
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=pack.cjs.map
|
package/lib/build-tests/pack.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PACKAGE_PATH, TARBALL_FOLDER } from "./constants.js";
|
|
2
1
|
import { buildPackageJson } from "./buildPackageJson.js";
|
|
2
|
+
import { PACKAGE_PATH, TARBALL_FOLDER } from "./constants.js";
|
|
3
3
|
import { getRelativePath0 } from "./getRelativePath.js";
|
|
4
4
|
import { join } from "path";
|
|
5
5
|
import { writeFile } from "fs/promises";
|
|
6
6
|
import sh from "shelljs";
|
|
7
|
-
|
|
7
|
+
// src/build-tests/pack.ts
|
|
8
8
|
/**
|
|
9
9
|
* Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.
|
|
10
10
|
*
|
|
@@ -22,7 +22,6 @@ const pack = async () => {
|
|
|
22
22
|
sh.cd("..");
|
|
23
23
|
return getRelativePath0(out1);
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { pack };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=pack.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_array = require("../utils/array.cjs");
|
|
3
|
+
const require_rolldown_config_plugins_typescript_config = require("../rolldown-config/plugins/typescript.config.cjs");
|
|
4
|
+
const require_pack_constants = require("./constants.cjs");
|
|
5
|
+
const require_pack_input = require("./input.cjs");
|
|
6
|
+
const require_pack_output = require("./output.cjs");
|
|
7
|
+
const require_pack_plugins_index = require("./plugins/index.cjs");
|
|
8
|
+
// src/pack/config.ts
|
|
9
|
+
/**
|
|
10
|
+
* Generates a Vite+ Pack configuration using default or customized options.
|
|
11
|
+
*
|
|
12
|
+
* The returned object is meant to be used as the `pack` field of a Vite+
|
|
13
|
+
* configuration:
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { defineConfig } from '@bemedev/dev-utils/pack';
|
|
18
|
+
* import { defineConfig as defineViteConfig } from 'vite-plus';
|
|
19
|
+
*
|
|
20
|
+
* export default defineViteConfig({
|
|
21
|
+
* pack: defineConfig.bemedev(),
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param additionals - Optional build configuration parameters of type {@linkcode Params}.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
const defineConfig = (additionals) => {
|
|
29
|
+
return defineConfig.default(additionals);
|
|
30
|
+
};
|
|
31
|
+
const producePlugins = ({ circularDeps, plugins, ignoresJS, sourcemap, dir } = {}) => {
|
|
32
|
+
const unordered = {
|
|
33
|
+
circulars: () => require_pack_plugins_index.DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),
|
|
34
|
+
clean: () => require_pack_plugins_index.DEFAULT_PLUGINS.clean({
|
|
35
|
+
ignoresJS,
|
|
36
|
+
sourcemap,
|
|
37
|
+
dir
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
return plugins ? plugins.map((p) => {
|
|
41
|
+
if (typeof p === "string") return unordered[p]();
|
|
42
|
+
return p;
|
|
43
|
+
}).filter((p) => !!p) : [unordered.circulars()];
|
|
44
|
+
};
|
|
45
|
+
defineConfig.default = ({ dir, sourcemap: _sourcemap = false, excludesTS, ignoresJS, externals, dts, circularDeps, plugins: _plugins, ...rest } = {}) => {
|
|
46
|
+
const config = require_rolldown_config_plugins_typescript_config.getConfig(process.cwd());
|
|
47
|
+
const entry = require_pack_input.buildEntry(...require_utils_array.toArray(excludesTS));
|
|
48
|
+
const declarationMap = !_sourcemap ? config.options.declarationMap : _sourcemap;
|
|
49
|
+
const sourcemap = !_sourcemap ? config.options.sourceMap : _sourcemap;
|
|
50
|
+
const output = require_pack_output.buildOutput(config.options.outDir ?? dir, sourcemap);
|
|
51
|
+
const neverBundle = require_utils_array.toArray(externals);
|
|
52
|
+
const _defaultDts = {
|
|
53
|
+
generator: "tsgo",
|
|
54
|
+
sourcemap: declarationMap
|
|
55
|
+
};
|
|
56
|
+
const __dts = !dts ? config.options.declaration === true ? _defaultDts : false : dts === true ? _defaultDts : typeof dts === "string" ? dts : {
|
|
57
|
+
...dts,
|
|
58
|
+
sourcemap: declarationMap
|
|
59
|
+
};
|
|
60
|
+
const plugins = producePlugins({
|
|
61
|
+
circularDeps,
|
|
62
|
+
plugins: _plugins,
|
|
63
|
+
ignoresJS,
|
|
64
|
+
sourcemap,
|
|
65
|
+
dir
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
...rest,
|
|
69
|
+
...output,
|
|
70
|
+
entry,
|
|
71
|
+
platform: "node",
|
|
72
|
+
dts: __dts,
|
|
73
|
+
deps: {
|
|
74
|
+
...rest.deps,
|
|
75
|
+
neverBundle
|
|
76
|
+
},
|
|
77
|
+
plugins
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
defineConfig.fast = (rest) => {
|
|
81
|
+
return defineConfig.default({
|
|
82
|
+
...rest,
|
|
83
|
+
dts: {
|
|
84
|
+
generator: "oxc",
|
|
85
|
+
eager: true
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
defineConfig.bemedev = (additionals) => {
|
|
90
|
+
const circularDeps = require_pack_constants.DEFAULT_CIRCULAR_DEPS.concat(require_utils_array.toArray(additionals?.circularDeps));
|
|
91
|
+
const excludesTS = require_pack_constants.DEFAULT_EXCLUDE.concat(require_utils_array.toArray(additionals?.excludesTS));
|
|
92
|
+
const _sourcemap = additionals?.sourcemap;
|
|
93
|
+
const sourcemap = _sourcemap === void 0 || _sourcemap === true;
|
|
94
|
+
return defineConfig.default({
|
|
95
|
+
...additionals,
|
|
96
|
+
circularDeps,
|
|
97
|
+
excludesTS,
|
|
98
|
+
sourcemap
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
exports.defineConfig = defineConfig;
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["DEFAULT_PLUGINS","getConfig","buildEntry","toArray","buildOutput","DEFAULT_CIRCULAR_DEPS","DEFAULT_EXCLUDE"],"sources":["../../src/pack/config.ts"],"sourcesContent":["import { toArray } from '#utils';\n\nimport { getConfig } from '../rolldown-config/plugins/typescript.config';\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildEntry } from './input';\nimport { buildOutput } from './output';\nimport { DEFAULT_PLUGINS } from './plugins';\nimport type { Config_F, DtsOptions, Params } from './types';\n\n/**\n * Generates a Vite+ Pack configuration using default or customized options.\n *\n * The returned object is meant to be used as the `pack` field of a Vite+\n * configuration:\n *\n * @example\n * ```ts\n * import { defineConfig } from '@bemedev/dev-utils/pack';\n * import { defineConfig as defineViteConfig } from 'vite-plus';\n *\n * export default defineViteConfig({\n * pack: defineConfig.bemedev(),\n * });\n * ```\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n plugins,\n ignoresJS,\n sourcemap,\n dir,\n}: Params = {}) => {\n const unordered = {\n circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),\n clean: () => DEFAULT_PLUGINS.clean({ ignoresJS, sourcemap, dir }),\n };\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : [unordered.circulars()];\n};\n\ndefineConfig.default = ({\n dir,\n sourcemap: _sourcemap = false,\n excludesTS,\n ignoresJS,\n externals,\n dts,\n circularDeps,\n plugins: _plugins,\n ...rest\n} = {}) => {\n const config = getConfig(process.cwd());\n const entry = buildEntry(...toArray(excludesTS));\n const declarationMap = !_sourcemap ? config.options.declarationMap : _sourcemap;\n const sourcemap = !_sourcemap ? config.options.sourceMap : _sourcemap;\n const output = buildOutput(config.options.outDir ?? dir, sourcemap);\n const neverBundle = toArray(externals);\n\n const _defaultDts: DtsOptions = { generator: 'tsgo', sourcemap: declarationMap };\n\n const __dts: DtsOptions = !dts\n ? config.options.declaration === true\n ? _defaultDts\n : false\n : dts === true\n ? _defaultDts\n : typeof dts === 'string'\n ? dts\n : { ...dts, sourcemap: declarationMap };\n\n const plugins = producePlugins({\n circularDeps,\n plugins: _plugins,\n ignoresJS,\n sourcemap,\n dir,\n });\n\n return {\n ...rest,\n ...output,\n entry,\n platform: 'node',\n dts: __dts,\n deps: { ...rest.deps, neverBundle },\n plugins,\n };\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({ ...rest, dts: { generator: 'oxc', eager: true } });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,SACA,WACA,WACA,QACU,CAAC,MAAM;CACjB,MAAM,YAAY;EAChB,iBAAiBA,2BAAAA,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,aAAaA,2BAAAA,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;CAClE;CAEA,OAAO,UACH,QACG,KAAI,MAAK;EACR,IAAI,OAAO,MAAM,UAAU,OAAO,UAAU,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC,CAAC,CACD,QAAO,MAAK,CAAC,CAAC,CAAC,IAClB,CAAC,UAAU,UAAU,CAAC;AAC5B;AAEA,aAAa,WAAW,EACtB,KACA,WAAW,aAAa,OACxB,YACA,WACA,WACA,KACA,cACA,SAAS,UACT,GAAG,SACD,CAAC,MAAM;CACT,MAAM,SAASC,kDAAAA,UAAU,QAAQ,IAAI,CAAC;CACtC,MAAM,QAAQC,mBAAAA,WAAW,GAAGC,oBAAAA,QAAQ,UAAU,CAAC;CAC/C,MAAM,iBAAiB,CAAC,aAAa,OAAO,QAAQ,iBAAiB;CACrE,MAAM,YAAY,CAAC,aAAa,OAAO,QAAQ,YAAY;CAC3D,MAAM,SAASC,oBAAAA,YAAY,OAAO,QAAQ,UAAU,KAAK,SAAS;CAClE,MAAM,cAAcD,oBAAAA,QAAQ,SAAS;CAErC,MAAM,cAA0B;EAAE,WAAW;EAAQ,WAAW;CAAe;CAE/E,MAAM,QAAoB,CAAC,MACvB,OAAO,QAAQ,gBAAgB,OAC7B,cACA,QACF,QAAQ,OACN,cACA,OAAO,QAAQ,WACb,MACA;EAAE,GAAG;EAAK,WAAW;CAAe;CAE5C,MAAM,UAAU,eAAe;EAC7B;EACA,SAAS;EACT;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA,UAAU;EACV,KAAK;EACL,MAAM;GAAE,GAAG,KAAK;GAAM;EAAY;EAClC;CACF;AACF;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAAE,GAAG;EAAM,KAAK;GAAE,WAAW;GAAO,OAAO;EAAK;CAAE,CAAC;AACjF;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAeE,uBAAAA,sBAAsB,OACzCF,oBAAAA,QAAQ,aAAa,YAAY,CACnC;CAEA,MAAM,aAAaG,uBAAAA,gBAAgB,OAAOH,oBAAAA,QAAQ,aAAa,UAAU,CAAC;CAC1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Config_F } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a Vite+ Pack configuration using default or customized options.
|
|
4
|
+
*
|
|
5
|
+
* The returned object is meant to be used as the `pack` field of a Vite+
|
|
6
|
+
* configuration:
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { defineConfig } from '@bemedev/dev-utils/pack';
|
|
11
|
+
* import { defineConfig as defineViteConfig } from 'vite-plus';
|
|
12
|
+
*
|
|
13
|
+
* export default defineViteConfig({
|
|
14
|
+
* pack: defineConfig.bemedev(),
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param additionals - Optional build configuration parameters of type {@linkcode Params}.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare const defineConfig: Config_F;
|