@powerlines/plugin-tsdown 0.1.251 → 0.1.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-BOzEPSe_.d.cts +8 -0
- package/dist/build-BOzEPSe_.d.cts.map +1 -0
- package/dist/build-DJTI0ZMx.cjs +0 -0
- package/dist/build-XTM4L3VY.mjs +1 -0
- package/dist/build-t47JyYHN.d.mts +8 -0
- package/dist/build-t47JyYHN.d.mts.map +1 -0
- package/dist/helpers/index.cjs +8 -7
- package/dist/helpers/index.d.cts +5 -2
- package/dist/helpers/index.d.mts +5 -2
- package/dist/helpers/index.mjs +3 -2
- package/dist/helpers/resolve-options.cjs +5 -127
- package/dist/helpers/resolve-options.d.cts +2 -30
- package/dist/helpers/resolve-options.d.mts +2 -31
- package/dist/helpers/resolve-options.mjs +2 -123
- package/dist/helpers/unplugin.cjs +2 -11
- package/dist/helpers/unplugin.d.cts +4 -8
- package/dist/helpers/unplugin.d.mts +4 -8
- package/dist/helpers/unplugin.mjs +2 -11
- package/dist/helpers-C9XSjwSZ.mjs +1 -0
- package/dist/helpers-yB1XkvQI.cjs +0 -0
- package/dist/index-B_e8BwCm.d.cts +1 -0
- package/dist/index-CW2WHUXP.d.mts +1 -0
- package/dist/index-Cc7fCJU9.d.mts +1 -0
- package/dist/index-CiBIKhMu.d.cts +1 -0
- package/dist/index.cjs +16 -14
- package/dist/index.d.cts +7 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -6
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-BElgq92H.d.mts +19 -0
- package/dist/plugin-BElgq92H.d.mts.map +1 -0
- package/dist/plugin-C2QQwbPM.d.cts +19 -0
- package/dist/plugin-C2QQwbPM.d.cts.map +1 -0
- package/dist/plugin-D3B5E_Hg.mjs +1 -0
- package/dist/plugin-D5qyQPqC.cjs +0 -0
- package/dist/resolve-options-BqY8g1Lc.d.mts +30 -0
- package/dist/resolve-options-BqY8g1Lc.d.mts.map +1 -0
- package/dist/resolve-options-CSWiRNVz.mjs +123 -0
- package/dist/resolve-options-CSWiRNVz.mjs.map +1 -0
- package/dist/resolve-options-Ctkjvfj3.d.cts +30 -0
- package/dist/resolve-options-Ctkjvfj3.d.cts.map +1 -0
- package/dist/resolve-options-D2gIEZW3.cjs +179 -0
- package/dist/types/build.cjs +1 -0
- package/dist/types/build.d.cts +2 -8
- package/dist/types/build.d.mts +2 -8
- package/dist/types/build.mjs +2 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +3 -20
- package/dist/types/plugin.d.mts +3 -21
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-D208vOSb.cjs +0 -0
- package/dist/types-Dv2cgIDx.mjs +1 -0
- package/dist/unplugin-8qvZ1vSF.cjs +16 -0
- package/dist/unplugin-C1z93_YH.d.cts +8 -0
- package/dist/unplugin-C1z93_YH.d.cts.map +1 -0
- package/dist/unplugin-CLFi0U2r.d.mts +8 -0
- package/dist/unplugin-CLFi0U2r.d.mts.map +1 -0
- package/dist/unplugin-kYkLMXDM.mjs +11 -0
- package/dist/unplugin-kYkLMXDM.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/core/src/lib/logger.cjs +0 -41
- package/dist/core/src/lib/logger.mjs +0 -40
- package/dist/core/src/lib/logger.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/helpers.cjs +0 -19
- package/dist/core/src/lib/unplugin/helpers.mjs +0 -19
- package/dist/core/src/lib/unplugin/helpers.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/index.cjs +0 -3
- package/dist/core/src/lib/unplugin/index.mjs +0 -5
- package/dist/core/src/lib/unplugin/module-resolution.cjs +0 -66
- package/dist/core/src/lib/unplugin/module-resolution.mjs +0 -66
- package/dist/core/src/lib/unplugin/module-resolution.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/plugin.cjs +0 -71
- package/dist/core/src/lib/unplugin/plugin.mjs +0 -71
- package/dist/core/src/lib/unplugin/plugin.mjs.map +0 -1
- package/dist/core/src/lib/utilities/format.cjs +0 -29
- package/dist/core/src/lib/utilities/format.mjs +0 -29
- package/dist/core/src/lib/utilities/format.mjs.map +0 -1
- package/dist/core/src/lib/utilities/source-file.cjs +0 -22
- package/dist/core/src/lib/utilities/source-file.mjs +0 -21
- package/dist/core/src/lib/utilities/source-file.mjs.map +0 -1
- package/dist/core/src/plugin-utils/build-helpers.cjs +0 -35
- package/dist/core/src/plugin-utils/build-helpers.mjs +0 -35
- package/dist/core/src/plugin-utils/build-helpers.mjs.map +0 -1
- package/dist/core/src/plugin-utils/context-helpers.cjs +0 -2
- package/dist/core/src/plugin-utils/context-helpers.mjs +0 -4
- package/dist/core/src/plugin-utils/extend.cjs +0 -3
- package/dist/core/src/plugin-utils/extend.mjs +0 -5
- package/dist/core/src/plugin-utils/format-package-json.cjs +0 -19
- package/dist/core/src/plugin-utils/format-package-json.mjs +0 -19
- package/dist/core/src/plugin-utils/format-package-json.mjs.map +0 -1
- package/dist/core/src/plugin-utils/get-config-path.cjs +0 -1
- package/dist/core/src/plugin-utils/get-config-path.mjs +0 -3
- package/dist/core/src/plugin-utils/helpers.cjs +0 -51
- package/dist/core/src/plugin-utils/helpers.mjs +0 -48
- package/dist/core/src/plugin-utils/helpers.mjs.map +0 -1
- package/dist/core/src/plugin-utils/index.cjs +0 -8
- package/dist/core/src/plugin-utils/index.mjs +0 -10
- package/dist/core/src/plugin-utils/merge.cjs +0 -47
- package/dist/core/src/plugin-utils/merge.mjs +0 -47
- package/dist/core/src/plugin-utils/merge.mjs.map +0 -1
- package/dist/core/src/plugin-utils/paths.cjs +0 -2
- package/dist/core/src/plugin-utils/paths.mjs +0 -4
- package/dist/core/src/types/api.d.cts +0 -103
- package/dist/core/src/types/api.d.cts.map +0 -1
- package/dist/core/src/types/api.d.mts +0 -103
- package/dist/core/src/types/api.d.mts.map +0 -1
- package/dist/core/src/types/commands.cjs +0 -16
- package/dist/core/src/types/commands.d.cts +0 -9
- package/dist/core/src/types/commands.d.cts.map +0 -1
- package/dist/core/src/types/commands.d.mts +0 -10
- package/dist/core/src/types/commands.d.mts.map +0 -1
- package/dist/core/src/types/commands.mjs +0 -16
- package/dist/core/src/types/commands.mjs.map +0 -1
- package/dist/core/src/types/config.d.cts +0 -551
- package/dist/core/src/types/config.d.cts.map +0 -1
- package/dist/core/src/types/config.d.mts +0 -551
- package/dist/core/src/types/config.d.mts.map +0 -1
- package/dist/core/src/types/context.d.cts +0 -511
- package/dist/core/src/types/context.d.cts.map +0 -1
- package/dist/core/src/types/context.d.mts +0 -511
- package/dist/core/src/types/context.d.mts.map +0 -1
- package/dist/core/src/types/fs.d.cts +0 -487
- package/dist/core/src/types/fs.d.cts.map +0 -1
- package/dist/core/src/types/fs.d.mts +0 -487
- package/dist/core/src/types/fs.d.mts.map +0 -1
- package/dist/core/src/types/hooks.d.cts +0 -99
- package/dist/core/src/types/hooks.d.cts.map +0 -1
- package/dist/core/src/types/hooks.d.mts +0 -99
- package/dist/core/src/types/hooks.d.mts.map +0 -1
- package/dist/core/src/types/index.d.mts +0 -9
- package/dist/core/src/types/plugin.cjs +0 -31
- package/dist/core/src/types/plugin.d.cts +0 -204
- package/dist/core/src/types/plugin.d.cts.map +0 -1
- package/dist/core/src/types/plugin.d.mts +0 -204
- package/dist/core/src/types/plugin.d.mts.map +0 -1
- package/dist/core/src/types/plugin.mjs +0 -33
- package/dist/core/src/types/plugin.mjs.map +0 -1
- package/dist/core/src/types/tsconfig.d.cts +0 -70
- package/dist/core/src/types/tsconfig.d.cts.map +0 -1
- package/dist/core/src/types/tsconfig.d.mts +0 -70
- package/dist/core/src/types/tsconfig.d.mts.map +0 -1
- package/dist/core/src/types/unplugin.cjs +0 -22
- package/dist/core/src/types/unplugin.d.cts +0 -24
- package/dist/core/src/types/unplugin.d.cts.map +0 -1
- package/dist/core/src/types/unplugin.d.mts +0 -25
- package/dist/core/src/types/unplugin.d.mts.map +0 -1
- package/dist/core/src/types/unplugin.mjs +0 -22
- package/dist/core/src/types/unplugin.mjs.map +0 -1
- package/dist/helpers/resolve-options.d.cts.map +0 -1
- package/dist/helpers/resolve-options.d.mts.map +0 -1
- package/dist/helpers/resolve-options.mjs.map +0 -1
- package/dist/helpers/unplugin.d.cts.map +0 -1
- package/dist/helpers/unplugin.d.mts.map +0 -1
- package/dist/helpers/unplugin.mjs.map +0 -1
- package/dist/types/build.d.cts.map +0 -1
- package/dist/types/build.d.mts.map +0 -1
- package/dist/types/plugin.d.cts.map +0 -1
- package/dist/types/plugin.d.mts.map +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
3
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
4
|
-
require("@stryke/fs/read-file");
|
|
5
|
-
require("magic-string");
|
|
6
|
-
|
|
7
|
-
//#region ../core/src/lib/utilities/source-file.ts
|
|
8
|
-
/**
|
|
9
|
-
* Get the string from the source.
|
|
10
|
-
*
|
|
11
|
-
* @param code - The source string or magic string.
|
|
12
|
-
* @returns The source string.
|
|
13
|
-
*/
|
|
14
|
-
function getString(code) {
|
|
15
|
-
if (!code) return "";
|
|
16
|
-
if ((0, __stryke_type_checks_is_string.isString)(code)) return code;
|
|
17
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(code) && "code" in code) return code.code;
|
|
18
|
-
return code.toString();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
exports.getString = getString;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
3
|
-
import "@stryke/fs/read-file";
|
|
4
|
-
|
|
5
|
-
//#region ../core/src/lib/utilities/source-file.ts
|
|
6
|
-
/**
|
|
7
|
-
* Get the string from the source.
|
|
8
|
-
*
|
|
9
|
-
* @param code - The source string or magic string.
|
|
10
|
-
* @returns The source string.
|
|
11
|
-
*/
|
|
12
|
-
function getString(code) {
|
|
13
|
-
if (!code) return "";
|
|
14
|
-
if (isString(code)) return code;
|
|
15
|
-
if (isSetObject(code) && "code" in code) return code.code;
|
|
16
|
-
return code.toString();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { getString };
|
|
21
|
-
//# sourceMappingURL=source-file.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-file.mjs","names":[],"sources":["../../../../../../core/src/lib/utilities/source-file.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { readFileIfExistingSync } from \"@stryke/fs/read-file\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport MagicString from \"magic-string\";\nimport { TransformResult } from \"unplugin\";\nimport { SourceFile } from \"../../types/context\";\n\n/**\n * Get the string from the source.\n *\n * @param code - The source string or magic string.\n * @returns The source string.\n */\nexport function getString(\n code: string | MagicString | TransformResult\n): string {\n if (!code) {\n return \"\";\n }\n\n if (isString(code)) {\n return code;\n }\n\n if (isSetObject(code) && \"code\" in code) {\n return code.code;\n }\n\n return code.toString();\n}\n\n/**\n * Get the magic string.\n *\n * @param code - The source string or magic string.\n * @returns The magic string.\n */\nexport function getMagicString(code: string | MagicString): MagicString {\n if (isString(code)) {\n return new MagicString(code);\n }\n\n return code;\n}\n\n/**\n * Get the source file.\n *\n * @param code - The source code.\n * @param id - The name of the file.\n * @returns The source file.\n */\nexport function getSourceFile(\n code: string | MagicString,\n id: string\n): SourceFile {\n const content = code ?? readFileIfExistingSync(id);\n\n return {\n id,\n code: getMagicString(content),\n env: []\n };\n}\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,UACd,MACQ;AACR,KAAI,CAAC,KACH,QAAO;AAGT,KAAI,SAAS,KAAK,CAChB,QAAO;AAGT,KAAI,YAAY,KAAK,IAAI,UAAU,KACjC,QAAO,KAAK;AAGd,QAAO,KAAK,UAAU"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
3
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
4
|
-
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
5
|
-
let __stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
6
|
-
|
|
7
|
-
//#region ../core/src/plugin-utils/build-helpers.ts
|
|
8
|
-
/**
|
|
9
|
-
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
10
|
-
*
|
|
11
|
-
* @param context - The build context.
|
|
12
|
-
* @returns The dependency configuration.
|
|
13
|
-
*/
|
|
14
|
-
function getDependencyConfig(context) {
|
|
15
|
-
const noExternal = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.resolve.noExternal).concat(context.builtins));
|
|
16
|
-
const external = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.resolve.external).reduce((ret, ext) => {
|
|
17
|
-
if ((0, __stryke_type_checks_is_regexp.isRegExp)(ext)) {
|
|
18
|
-
if (noExternal.some((noExt) => (0, __stryke_type_checks_is_regexp.isRegExp)(noExt) && noExt.source === ext.source)) return ret;
|
|
19
|
-
const noExts = noExternal.filter((noExt) => (0, __stryke_type_checks_is_set_string.isSetString)(noExt) && ext.test(noExt));
|
|
20
|
-
if (noExts.length > 0) {
|
|
21
|
-
ret.push(new RegExp(noExts.reduce((regex, noExt) => `(?!${(0, __stryke_type_checks_is_regexp.isRegExp)(noExt) ? noExt.source : `^${noExt}$`})${regex}`, `${ext.source.replace(/^\^@\?/, "^@").replace(/^@\?/, "@").replace(/\$$/, "").replace(/\.\*$/, "")}.*$`)));
|
|
22
|
-
return ret;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
ret.push(ext);
|
|
26
|
-
return ret;
|
|
27
|
-
}, []));
|
|
28
|
-
return {
|
|
29
|
-
external: external.length === 0 ? void 0 : external,
|
|
30
|
-
noExternal: noExternal.length === 0 ? void 0 : noExternal
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
exports.getDependencyConfig = getDependencyConfig;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
2
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
3
|
-
import { getUnique } from "@stryke/helpers/get-unique";
|
|
4
|
-
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
5
|
-
|
|
6
|
-
//#region ../core/src/plugin-utils/build-helpers.ts
|
|
7
|
-
/**
|
|
8
|
-
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The build context.
|
|
11
|
-
* @returns The dependency configuration.
|
|
12
|
-
*/
|
|
13
|
-
function getDependencyConfig(context) {
|
|
14
|
-
const noExternal = getUnique(toArray(context.config.resolve.noExternal).concat(context.builtins));
|
|
15
|
-
const external = getUnique(toArray(context.config.resolve.external).reduce((ret, ext) => {
|
|
16
|
-
if (isRegExp(ext)) {
|
|
17
|
-
if (noExternal.some((noExt) => isRegExp(noExt) && noExt.source === ext.source)) return ret;
|
|
18
|
-
const noExts = noExternal.filter((noExt) => isSetString(noExt) && ext.test(noExt));
|
|
19
|
-
if (noExts.length > 0) {
|
|
20
|
-
ret.push(new RegExp(noExts.reduce((regex, noExt) => `(?!${isRegExp(noExt) ? noExt.source : `^${noExt}$`})${regex}`, `${ext.source.replace(/^\^@\?/, "^@").replace(/^@\?/, "@").replace(/\$$/, "").replace(/\.\*$/, "")}.*$`)));
|
|
21
|
-
return ret;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
ret.push(ext);
|
|
25
|
-
return ret;
|
|
26
|
-
}, []));
|
|
27
|
-
return {
|
|
28
|
-
external: external.length === 0 ? void 0 : external,
|
|
29
|
-
noExternal: noExternal.length === 0 ? void 0 : noExternal
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
export { getDependencyConfig };
|
|
35
|
-
//# sourceMappingURL=build-helpers.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-helpers.mjs","names":[],"sources":["../../../../../core/src/plugin-utils/build-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { ResolveConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport interface GetDependencyConfigResult {\n external: ResolveConfig[\"external\"];\n noExternal: ResolveConfig[\"noExternal\"];\n}\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig(\n context: Context\n): GetDependencyConfigResult {\n const noExternal = getUnique(\n toArray(context.config.resolve.noExternal).concat(context.builtins)\n );\n\n const external = getUnique(\n toArray(context.config.resolve.external).reduce(\n (ret, ext) => {\n if (isRegExp(ext)) {\n if (\n noExternal.some(\n noExt => isRegExp(noExt) && noExt.source === ext.source\n )\n ) {\n return ret;\n }\n\n const noExts = noExternal.filter(\n noExt => isSetString(noExt) && ext.test(noExt)\n );\n if (noExts.length > 0) {\n ret.push(\n new RegExp(\n noExts.reduce(\n (regex: string, noExt: string | RegExp) =>\n `(?!${\n isRegExp(noExt) ? noExt.source : `^${noExt}$`\n })${regex}`,\n `${ext.source\n .replace(/^\\^@\\?/, \"^@\")\n .replace(/^@\\?/, \"@\")\n .replace(/\\$$/, \"\")\n .replace(/\\.\\*$/, \"\")}.*$`\n )\n )\n );\n return ret;\n }\n }\n\n ret.push(ext);\n return ret;\n },\n [] as (string | RegExp)[]\n )\n );\n\n return {\n external: external.length === 0 ? undefined : external,\n noExternal: noExternal.length === 0 ? undefined : noExternal\n };\n}\n"],"mappings":";;;;;;;;;;;;AAoCA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,aAAa,UACjB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,CAAC,OAAO,QAAQ,SAAS,CACpE;CAED,MAAM,WAAW,UACf,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC,QACtC,KAAK,QAAQ;AACZ,MAAI,SAAS,IAAI,EAAE;AACjB,OACE,WAAW,MACT,UAAS,SAAS,MAAM,IAAI,MAAM,WAAW,IAAI,OAClD,CAED,QAAO;GAGT,MAAM,SAAS,WAAW,QACxB,UAAS,YAAY,MAAM,IAAI,IAAI,KAAK,MAAM,CAC/C;AACD,OAAI,OAAO,SAAS,GAAG;AACrB,QAAI,KACF,IAAI,OACF,OAAO,QACJ,OAAe,UACd,MACE,SAAS,MAAM,GAAG,MAAM,SAAS,IAAI,MAAM,GAC5C,GAAG,SACN,GAAG,IAAI,OACJ,QAAQ,UAAU,KAAK,CACvB,QAAQ,QAAQ,IAAI,CACpB,QAAQ,OAAO,GAAG,CAClB,QAAQ,SAAS,GAAG,CAAC,KACzB,CACF,CACF;AACD,WAAO;;;AAIX,MAAI,KAAK,IAAI;AACb,SAAO;IAET,EAAE,CACH,CACF;AAED,QAAO;EACL,UAAU,SAAS,WAAW,IAAI,SAAY;EAC9C,YAAY,WAAW,WAAW,IAAI,SAAY;EACnD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_format = require('../lib/utilities/format.cjs');
|
|
3
|
-
let __stryke_path_join = require("@stryke/path/join");
|
|
4
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
-
|
|
6
|
-
//#region ../core/src/plugin-utils/format-package-json.ts
|
|
7
|
-
/**
|
|
8
|
-
* Formats the `package.json` file in the project root.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The powerlines context.
|
|
11
|
-
*/
|
|
12
|
-
async function formatPackageJson(context) {
|
|
13
|
-
const packageJsonPath = (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "package.json");
|
|
14
|
-
const packageJsonFile = await context.fs.read(packageJsonPath);
|
|
15
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(packageJsonFile)) await context.fs.write(packageJsonPath, await require_format.format(context, packageJsonPath, packageJsonFile));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
exports.formatPackageJson = formatPackageJson;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { format } from "../lib/utilities/format.mjs";
|
|
2
|
-
import { joinPaths } from "@stryke/path/join";
|
|
3
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
-
|
|
5
|
-
//#region ../core/src/plugin-utils/format-package-json.ts
|
|
6
|
-
/**
|
|
7
|
-
* Formats the `package.json` file in the project root.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The powerlines context.
|
|
10
|
-
*/
|
|
11
|
-
async function formatPackageJson(context) {
|
|
12
|
-
const packageJsonPath = joinPaths(context.workspaceConfig.workspaceRoot, context.config.root, "package.json");
|
|
13
|
-
const packageJsonFile = await context.fs.read(packageJsonPath);
|
|
14
|
-
if (isSetString(packageJsonFile)) await context.fs.write(packageJsonPath, await format(context, packageJsonPath, packageJsonFile));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { formatPackageJson };
|
|
19
|
-
//# sourceMappingURL=format-package-json.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-package-json.mjs","names":[],"sources":["../../../../../core/src/plugin-utils/format-package-json.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { format } from \"../lib/utilities/format\";\nimport { Context } from \"../types/context\";\n\n/**\n * Formats the `package.json` file in the project root.\n *\n * @param context - The powerlines context.\n */\nexport async function formatPackageJson(context: Context) {\n const packageJsonPath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"package.json\"\n );\n\n const packageJsonFile = await context.fs.read(packageJsonPath);\n if (isSetString(packageJsonFile)) {\n await context.fs.write(\n packageJsonPath,\n await format(context, packageJsonPath, packageJsonFile)\n );\n }\n}\n"],"mappings":";;;;;;;;;;AA4BA,eAAsB,kBAAkB,SAAkB;CACxD,MAAM,kBAAkB,UACtB,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,eACD;CAED,MAAM,kBAAkB,MAAM,QAAQ,GAAG,KAAK,gBAAgB;AAC9D,KAAI,YAAY,gBAAgB,CAC9B,OAAM,QAAQ,GAAG,MACf,iBACA,MAAM,OAAO,SAAS,iBAAiB,gBAAgB,CACxD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let __stryke_path_join = require("@stryke/path/join");
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
require('../types/unplugin.cjs');
|
|
3
|
-
require('../types/plugin.cjs');
|
|
4
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
6
|
-
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
7
|
-
require("@stryke/type-checks/is-undefined");
|
|
8
|
-
|
|
9
|
-
//#region ../core/src/plugin-utils/helpers.ts
|
|
10
|
-
/**
|
|
11
|
-
* Type guard to check if an value is a {@link PluginHook} function
|
|
12
|
-
*
|
|
13
|
-
* @param value - The value to check
|
|
14
|
-
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
15
|
-
*/
|
|
16
|
-
function isPluginHookObject(value) {
|
|
17
|
-
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "handler" in value && (0, __stryke_type_checks_is_function.isFunction)(value.handler);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Type guard to check if an value is a {@link PluginHook} function
|
|
21
|
-
*
|
|
22
|
-
* @param value - The value to check
|
|
23
|
-
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
24
|
-
*/
|
|
25
|
-
function isPluginHookFunction(value) {
|
|
26
|
-
return (0, __stryke_type_checks_is_function.isFunction)(value) || isPluginHookObject(value);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Type guard to check if an object is a {@link PluginHook}
|
|
30
|
-
*
|
|
31
|
-
* @param value - The object to check
|
|
32
|
-
* @returns True if the object is a {@link PluginHook}, false otherwise
|
|
33
|
-
*/
|
|
34
|
-
function isPluginHook(value) {
|
|
35
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Extract the hook handler function from a plugin hook
|
|
39
|
-
*
|
|
40
|
-
* @param pluginHook - The plugin hook to extract the handler function from
|
|
41
|
-
* @returns The hook handler function
|
|
42
|
-
*/
|
|
43
|
-
function getHookHandler(pluginHook) {
|
|
44
|
-
return (0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? pluginHook : pluginHook.handler;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
exports.getHookHandler = getHookHandler;
|
|
49
|
-
exports.isPluginHook = isPluginHook;
|
|
50
|
-
exports.isPluginHookFunction = isPluginHookFunction;
|
|
51
|
-
exports.isPluginHookObject = isPluginHookObject;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import "../types/unplugin.mjs";
|
|
2
|
-
import "../types/plugin.mjs";
|
|
3
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
5
|
-
import { isFunction } from "@stryke/type-checks/is-function";
|
|
6
|
-
import "@stryke/type-checks/is-undefined";
|
|
7
|
-
|
|
8
|
-
//#region ../core/src/plugin-utils/helpers.ts
|
|
9
|
-
/**
|
|
10
|
-
* Type guard to check if an value is a {@link PluginHook} function
|
|
11
|
-
*
|
|
12
|
-
* @param value - The value to check
|
|
13
|
-
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
14
|
-
*/
|
|
15
|
-
function isPluginHookObject(value) {
|
|
16
|
-
return isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Type guard to check if an value is a {@link PluginHook} function
|
|
20
|
-
*
|
|
21
|
-
* @param value - The value to check
|
|
22
|
-
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
23
|
-
*/
|
|
24
|
-
function isPluginHookFunction(value) {
|
|
25
|
-
return isFunction(value) || isPluginHookObject(value);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Type guard to check if an object is a {@link PluginHook}
|
|
29
|
-
*
|
|
30
|
-
* @param value - The object to check
|
|
31
|
-
* @returns True if the object is a {@link PluginHook}, false otherwise
|
|
32
|
-
*/
|
|
33
|
-
function isPluginHook(value) {
|
|
34
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Extract the hook handler function from a plugin hook
|
|
38
|
-
*
|
|
39
|
-
* @param pluginHook - The plugin hook to extract the handler function from
|
|
40
|
-
* @returns The hook handler function
|
|
41
|
-
*/
|
|
42
|
-
function getHookHandler(pluginHook) {
|
|
43
|
-
return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
export { getHookHandler, isPluginHook, isPluginHookFunction, isPluginHookObject };
|
|
48
|
-
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../../../core/src/plugin-utils/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n ResolvedConfig\n} from \"../types/config\";\nimport { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport {\n HookFields,\n PluginHooksListItem,\n UnpluginHooksListItem\n} from \"../types/hooks\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport {\n BUILDER_VARIANTS,\n UNPLUGIN_BUILDER_VARIANTS,\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n ) &&\n BUILDER_VARIANTS.every(\n variant =>\n isUndefined((value as Plugin<TContext>)[variant]) ||\n (variant in value && isSetObject((value as Plugin<TContext>)[variant]))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> = TField extends PluginHookFields\n ? PluginHooksListItem<TContext, TField>[\"handler\"]\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, TField>[\"handler\"]\n : never;\n\ntype HooksListItemForField<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> =\n TField extends PluginHookFields<TContext>\n ? PluginHooksListItem<TContext, Extract<TField, PluginHookFields<TContext>>>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, Extract<TField, UnpluginBuilderVariant>>\n : never;\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TField> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TField>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n): keys is PluginHookFields<TContext> {\n return (\n !isUnpluginHookKey(keys) &&\n PLUGIN_HOOKS_FIELDS.includes(keys as PluginHookFields<TContext>)\n );\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends PluginHooksListItem<TContext, TField> = PluginHooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n) {\n if (\n !checkDedupe(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as HooksListItemForField<\n TContext,\n TField\n >[\"handler\"];\n if (!handler) {\n return;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n"],"mappings":";;;;;;;;;;;;;;AAqJA,SAAgB,mBACd,OACwC;AACxC,QAAO,YAAY,MAAM,IAAI,aAAa,SAAS,WAAW,MAAM,QAAQ;;;;;;;;AAS9E,SAAgB,qBAAqB,OAAsC;AACzE,QAAO,WAAW,MAAM,IAAI,mBAAmB,MAAM;;;;;;;;AASvD,SAAgB,aAAa,OAAkD;AAC7E,QAAO,qBAAqB,MAAM,IAAI,mBAAmB,MAAM;;;;;;;;AA4BjE,SAAgB,eAId,YAC4C;AAC5C,QACE,WAAW,WAAW,GAAG,aAAa,WAAW"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const require_format_package_json = require('./format-package-json.cjs');
|
|
2
|
-
const require_build_helpers = require('./build-helpers.cjs');
|
|
3
|
-
require('./context-helpers.cjs');
|
|
4
|
-
const require_helpers = require('./helpers.cjs');
|
|
5
|
-
require('./merge.cjs');
|
|
6
|
-
require('./extend.cjs');
|
|
7
|
-
require('./get-config-path.cjs');
|
|
8
|
-
require('./paths.cjs');
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { formatPackageJson } from "./format-package-json.mjs";
|
|
2
|
-
import { getDependencyConfig } from "./build-helpers.mjs";
|
|
3
|
-
import "./context-helpers.mjs";
|
|
4
|
-
import { getHookHandler, isPluginHook, isPluginHookFunction, isPluginHookObject } from "./helpers.mjs";
|
|
5
|
-
import "./merge.mjs";
|
|
6
|
-
import "./extend.mjs";
|
|
7
|
-
import "./get-config-path.mjs";
|
|
8
|
-
import "./paths.mjs";
|
|
9
|
-
|
|
10
|
-
export { };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_helpers = require('./helpers.cjs');
|
|
3
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
4
|
-
let defu = require("defu");
|
|
5
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
6
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
-
|
|
8
|
-
//#region ../core/src/plugin-utils/merge.ts
|
|
9
|
-
const mergePlugin = (0, defu.createDefu)((obj, key, value) => {
|
|
10
|
-
if (require_helpers.isPluginHook(obj[key]) && require_helpers.isPluginHook(value)) {
|
|
11
|
-
obj[key] = {
|
|
12
|
-
...obj[key],
|
|
13
|
-
...value,
|
|
14
|
-
handler: async (...params) => {
|
|
15
|
-
const [resultA, resultB] = await Promise.all([require_helpers.getHookHandler(obj[key])(...params), require_helpers.getHookHandler(value)(...params)]);
|
|
16
|
-
return resultB && resultA ? (0, defu.default)(resultA, resultB) : resultA || resultB;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* Merges two configuration objects together, with special handling for string values.
|
|
25
|
-
* If the value from the second object is a non-empty string, it will overwrite the value from the first object.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* const configA = { name: "Default", version: "1.0.0" };
|
|
30
|
-
* const configB = { name: "Custom", description: "A custom config" };
|
|
31
|
-
* const mergedConfig = mergeConfig(configA, configB);
|
|
32
|
-
* // Result: { name: "Custom", version: "1.0.0", description: "A custom config" }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @param objA - The first configuration object.
|
|
36
|
-
* @param objB - The second configuration object.
|
|
37
|
-
* @returns The merged configuration object.
|
|
38
|
-
*/
|
|
39
|
-
const mergeConfig = (0, defu.createDefu)((obj, key, value) => {
|
|
40
|
-
if ((0, __stryke_type_checks_is_string.isString)(obj[key]) && (0, __stryke_type_checks_is_string.isString)(value)) {
|
|
41
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(value)) obj[key] = value;
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getHookHandler, isPluginHook } from "./helpers.mjs";
|
|
2
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
|
-
import defu$1, { createDefu } from "defu";
|
|
4
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
5
|
-
|
|
6
|
-
//#region ../core/src/plugin-utils/merge.ts
|
|
7
|
-
const mergePlugin = createDefu((obj, key, value) => {
|
|
8
|
-
if (isPluginHook(obj[key]) && isPluginHook(value)) {
|
|
9
|
-
obj[key] = {
|
|
10
|
-
...obj[key],
|
|
11
|
-
...value,
|
|
12
|
-
handler: async (...params) => {
|
|
13
|
-
const [resultA, resultB] = await Promise.all([getHookHandler(obj[key])(...params), getHookHandler(value)(...params)]);
|
|
14
|
-
return resultB && resultA ? defu$1(resultA, resultB) : resultA || resultB;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* Merges two configuration objects together, with special handling for string values.
|
|
23
|
-
* If the value from the second object is a non-empty string, it will overwrite the value from the first object.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const configA = { name: "Default", version: "1.0.0" };
|
|
28
|
-
* const configB = { name: "Custom", description: "A custom config" };
|
|
29
|
-
* const mergedConfig = mergeConfig(configA, configB);
|
|
30
|
-
* // Result: { name: "Custom", version: "1.0.0", description: "A custom config" }
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @param objA - The first configuration object.
|
|
34
|
-
* @param objB - The second configuration object.
|
|
35
|
-
* @returns The merged configuration object.
|
|
36
|
-
*/
|
|
37
|
-
const mergeConfig = createDefu((obj, key, value) => {
|
|
38
|
-
if (isString(obj[key]) && isString(value)) {
|
|
39
|
-
if (isSetString(value)) obj[key] = value;
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { };
|
|
47
|
-
//# sourceMappingURL=merge.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.mjs","names":["defu"],"sources":["../../../../../core/src/plugin-utils/merge.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport { PartialPlugin, ResolvedConfig } from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n\n/**\n * Merges two configuration objects together, with special handling for string values.\n * If the value from the second object is a non-empty string, it will overwrite the value from the first object.\n *\n * @example\n * ```ts\n * const configA = { name: \"Default\", version: \"1.0.0\" };\n * const configB = { name: \"Custom\", description: \"A custom config\" };\n * const mergedConfig = mergeConfig(configA, configB);\n * // Result: { name: \"Custom\", version: \"1.0.0\", description: \"A custom config\" }\n * ```\n *\n * @param objA - The first configuration object.\n * @param objB - The second configuration object.\n * @returns The merged configuration object.\n */\nexport const mergeConfig = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n }\n\n return false;\n}) as (...configs: unknown[]) => ResolvedConfig;\n"],"mappings":";;;;;;AAqCA,MAAM,cAAc,YAAY,KAAK,KAAK,UAAU;AAClD,KAAI,aAAa,IAAI,KAAK,IAAI,aAAa,MAAM,EAAE;AACjD,MAAI,OAAO;GACT,GAAG,IAAI;GACP,GAAG;GACH,SAAS,OAAO,GAAG,WAAkB;IACnC,MAAM,CAAC,SAAS,WAAW,MAAM,QAAQ,IAAI,CAE1C,eAAe,IAAI,KAAK,CAAS,GAAG,OAAO,EAE3C,eAAe,MAAM,CAAS,GAAG,OAAO,CAC1C,CAAC;AAEF,WAAO,WAAW,UAAUA,OAAK,SAAS,QAAQ,GAAG,WAAW;;GAEnE;AACD,SAAO;;AAGT,QAAO;EACP;;;;;;;;;;;;;;;;;AAoCF,MAAa,cAAc,YAAY,KAAK,KAAK,UAAU;AACzD,KAAI,SAAS,IAAI,KAAK,IAAI,SAAS,MAAM,EAAE;AACzC,MAAI,YAAY,MAAM,CACpB,KAAI,OAAO;AAGb,SAAO;;AAGT,QAAO;EACP"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { CallHookOptions, InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
2
|
-
import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
|
|
3
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, ResolvedConfig } from "./config.cjs";
|
|
4
|
-
|
|
5
|
-
//#region ../core/src/types/api.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Powerlines API Interface
|
|
9
|
-
*/
|
|
10
|
-
interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
11
|
-
/**
|
|
12
|
-
* The Powerlines shared API context
|
|
13
|
-
*/
|
|
14
|
-
context: APIContext<TResolvedConfig>;
|
|
15
|
-
/**
|
|
16
|
-
* Prepare the Powerlines API
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
20
|
-
*
|
|
21
|
-
* @param inlineConfig - The inline configuration for the prepare command
|
|
22
|
-
*/
|
|
23
|
-
prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Create a new Powerlines project
|
|
26
|
-
*
|
|
27
|
-
* @remarks
|
|
28
|
-
* This method will create a new Powerlines project in the current directory.
|
|
29
|
-
*
|
|
30
|
-
* @param inlineConfig - The inline configuration for the new command
|
|
31
|
-
* @returns A promise that resolves when the project has been created
|
|
32
|
-
*/
|
|
33
|
-
new: (inlineConfig: NewInlineConfig) => Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Clean any previously prepared artifacts
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* This method will remove the previous Powerlines artifacts from the project.
|
|
39
|
-
*
|
|
40
|
-
* @param inlineConfig - The inline configuration for the clean command
|
|
41
|
-
* @returns A promise that resolves when the clean command has completed
|
|
42
|
-
*/
|
|
43
|
-
clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Lint the project source code
|
|
46
|
-
*
|
|
47
|
-
* @param inlineConfig - The inline configuration for the lint command
|
|
48
|
-
* @returns A promise that resolves when the lint command has completed
|
|
49
|
-
*/
|
|
50
|
-
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Build the project
|
|
53
|
-
*
|
|
54
|
-
* @remarks
|
|
55
|
-
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
56
|
-
*
|
|
57
|
-
* @param inlineConfig - The inline configuration for the build command
|
|
58
|
-
* @returns A promise that resolves when the build command has completed
|
|
59
|
-
*/
|
|
60
|
-
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Prepare the documentation for the project
|
|
63
|
-
*
|
|
64
|
-
* @param inlineConfig - The inline configuration for the docs command
|
|
65
|
-
* @returns A promise that resolves when the documentation generation has completed
|
|
66
|
-
*/
|
|
67
|
-
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Deploy the project source code
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
73
|
-
*
|
|
74
|
-
* @param inlineConfig - The inline configuration for the deploy command
|
|
75
|
-
*/
|
|
76
|
-
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Finalization process
|
|
79
|
-
*
|
|
80
|
-
* @remarks
|
|
81
|
-
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
82
|
-
*
|
|
83
|
-
* @returns A promise that resolves when the finalization process has completed
|
|
84
|
-
*/
|
|
85
|
-
finalize: () => Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* Invokes the configured plugin hooks
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
|
|
91
|
-
*
|
|
92
|
-
* @param hook - The hook to call
|
|
93
|
-
* @param options - The options to provide to the hook
|
|
94
|
-
* @param args - The arguments to pass to the hook
|
|
95
|
-
* @returns The result of the hook call
|
|
96
|
-
*/
|
|
97
|
-
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
98
|
-
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
99
|
-
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
export { API };
|
|
103
|
-
//# sourceMappingURL=api.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.cts","names":[],"sources":["../../../../../core/src/types/api.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAsCA;AAA6C,UAA5B,GAA4B,CAAA,wBAAA,cAAA,GAAiB,cAAjB,CAAA,CAAA;EAAiB;;;EAgBtD,OAAA,EAZG,UAYH,CAZc,eAYd,CAAA;EACA;;;;;;;;EAiBkC,OAAA,EAAA,CAAA,YAAA,EAlBlC,mBAkBkC,GAjBlC,eAiBkC,GAhBlC,iBAgBkC,GAflC,iBAekC,GAdlC,gBAckC,GAblC,gBAakC,GAZlC,kBAYkC,EAAA,GAXnC,OAWmC,CAAA,IAAA,CAAA;EAYxB;;;;;;;;;EAsCO,GAAA,EAAA,CAAA,YAAA,EAlDH,eAkDG,EAAA,GAlDiB,OAkDjB,CAAA,IAAA,CAAA;EAAuB;;;;;;;;;EA4BnC,KAAA,EAAA,CAAA,YAAA,EAlEK,iBAkEL,GAlEyB,mBAkEzB,EAAA,GAjEN,OAiEM,CAAA,IAAA,CAAA;EAEyB;;;;;;uBA3Df,qBAAqB;;;;;;;;;;wBAWpB,sBAAsB;;;;;;;uBAQvB,qBAAqB;;;;;;;;;yBAUnB,uBAAuB;;;;;;;;;kBAU9B;;;;;;;;;;;;wCAcR,eACG;2BACgB,mBAAmB;cAEnC,oBAAoB,cAAc,kBAAkB,UAC1D,QACH,oBAAoB,cAAc,kBAAkB"}
|