@powerlines/core 0.0.8
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/index.cjs +65 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.mjs +22 -0
- package/dist/lib/config.cjs +90 -0
- package/dist/lib/config.cjs.map +1 -0
- package/dist/lib/config.d.cts +40 -0
- package/dist/lib/config.d.cts.map +1 -0
- package/dist/lib/config.d.mts +40 -0
- package/dist/lib/config.d.mts.map +1 -0
- package/dist/lib/config.mjs +86 -0
- package/dist/lib/config.mjs.map +1 -0
- package/dist/lib/constants/environments.cjs +17 -0
- package/dist/lib/constants/environments.cjs.map +1 -0
- package/dist/lib/constants/environments.d.cts +10 -0
- package/dist/lib/constants/environments.d.cts.map +1 -0
- package/dist/lib/constants/environments.d.mts +10 -0
- package/dist/lib/constants/environments.d.mts.map +1 -0
- package/dist/lib/constants/environments.mjs +11 -0
- package/dist/lib/constants/environments.mjs.map +1 -0
- package/dist/lib/constants/index.cjs +11 -0
- package/dist/lib/constants/index.d.cts +3 -0
- package/dist/lib/constants/index.d.mts +3 -0
- package/dist/lib/constants/index.mjs +4 -0
- package/dist/lib/constants/meta.cjs +9 -0
- package/dist/lib/constants/meta.cjs.map +1 -0
- package/dist/lib/constants/meta.d.cts +6 -0
- package/dist/lib/constants/meta.d.cts.map +1 -0
- package/dist/lib/constants/meta.d.mts +6 -0
- package/dist/lib/constants/meta.d.mts.map +1 -0
- package/dist/lib/constants/meta.mjs +7 -0
- package/dist/lib/constants/meta.mjs.map +1 -0
- package/dist/lib/entry.cjs +127 -0
- package/dist/lib/entry.cjs.map +1 -0
- package/dist/lib/entry.d.cts +47 -0
- package/dist/lib/entry.d.cts.map +1 -0
- package/dist/lib/entry.d.mts +48 -0
- package/dist/lib/entry.d.mts.map +1 -0
- package/dist/lib/entry.mjs +120 -0
- package/dist/lib/entry.mjs.map +1 -0
- package/dist/lib/index.cjs +50 -0
- package/dist/lib/index.d.cts +14 -0
- package/dist/lib/index.d.mts +16 -0
- package/dist/lib/index.mjs +17 -0
- package/dist/lib/logger.cjs +59 -0
- package/dist/lib/logger.cjs.map +1 -0
- package/dist/lib/logger.d.cts +23 -0
- package/dist/lib/logger.d.cts.map +1 -0
- package/dist/lib/logger.d.mts +24 -0
- package/dist/lib/logger.d.mts.map +1 -0
- package/dist/lib/logger.mjs +56 -0
- package/dist/lib/logger.mjs.map +1 -0
- package/dist/lib/unplugin/helpers.cjs +30 -0
- package/dist/lib/unplugin/helpers.cjs.map +1 -0
- package/dist/lib/unplugin/helpers.d.cts +24 -0
- package/dist/lib/unplugin/helpers.d.cts.map +1 -0
- package/dist/lib/unplugin/helpers.d.mts +24 -0
- package/dist/lib/unplugin/helpers.d.mts.map +1 -0
- package/dist/lib/unplugin/helpers.mjs +28 -0
- package/dist/lib/unplugin/helpers.mjs.map +1 -0
- package/dist/lib/unplugin/index.cjs +9 -0
- package/dist/lib/unplugin/index.d.cts +4 -0
- package/dist/lib/unplugin/index.d.mts +4 -0
- package/dist/lib/unplugin/index.mjs +5 -0
- package/dist/lib/unplugin/module-resolution.cjs +67 -0
- package/dist/lib/unplugin/module-resolution.cjs.map +1 -0
- package/dist/lib/unplugin/module-resolution.d.cts +21 -0
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -0
- package/dist/lib/unplugin/module-resolution.d.mts +21 -0
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -0
- package/dist/lib/unplugin/module-resolution.mjs +66 -0
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -0
- package/dist/lib/unplugin/plugin.cjs +105 -0
- package/dist/lib/unplugin/plugin.cjs.map +1 -0
- package/dist/lib/unplugin/plugin.d.cts +22 -0
- package/dist/lib/unplugin/plugin.d.cts.map +1 -0
- package/dist/lib/unplugin/plugin.d.mts +22 -0
- package/dist/lib/unplugin/plugin.d.mts.map +1 -0
- package/dist/lib/unplugin/plugin.mjs +103 -0
- package/dist/lib/unplugin/plugin.mjs.map +1 -0
- package/dist/lib/utilities/file-header.cjs +24 -0
- package/dist/lib/utilities/file-header.cjs.map +1 -0
- package/dist/lib/utilities/file-header.d.cts +13 -0
- package/dist/lib/utilities/file-header.d.cts.map +1 -0
- package/dist/lib/utilities/file-header.d.mts +13 -0
- package/dist/lib/utilities/file-header.d.mts.map +1 -0
- package/dist/lib/utilities/file-header.mjs +22 -0
- package/dist/lib/utilities/file-header.mjs.map +1 -0
- package/dist/lib/utilities/format.cjs +49 -0
- package/dist/lib/utilities/format.cjs.map +1 -0
- package/dist/lib/utilities/format.d.cts +25 -0
- package/dist/lib/utilities/format.d.cts.map +1 -0
- package/dist/lib/utilities/format.d.mts +25 -0
- package/dist/lib/utilities/format.d.mts.map +1 -0
- package/dist/lib/utilities/format.mjs +47 -0
- package/dist/lib/utilities/format.mjs.map +1 -0
- package/dist/lib/utilities/index.cjs +15 -0
- package/dist/lib/utilities/index.d.cts +6 -0
- package/dist/lib/utilities/index.d.mts +6 -0
- package/dist/lib/utilities/index.mjs +7 -0
- package/dist/lib/utilities/source-file.cjs +50 -0
- package/dist/lib/utilities/source-file.cjs.map +1 -0
- package/dist/lib/utilities/source-file.d.cts +31 -0
- package/dist/lib/utilities/source-file.d.cts.map +1 -0
- package/dist/lib/utilities/source-file.d.mts +31 -0
- package/dist/lib/utilities/source-file.d.mts.map +1 -0
- package/dist/lib/utilities/source-file.mjs +46 -0
- package/dist/lib/utilities/source-file.mjs.map +1 -0
- package/dist/lib/utilities/source-map.cjs +57 -0
- package/dist/lib/utilities/source-map.cjs.map +1 -0
- package/dist/lib/utilities/source-map.d.cts +17 -0
- package/dist/lib/utilities/source-map.d.cts.map +1 -0
- package/dist/lib/utilities/source-map.d.mts +17 -0
- package/dist/lib/utilities/source-map.d.mts.map +1 -0
- package/dist/lib/utilities/source-map.mjs +55 -0
- package/dist/lib/utilities/source-map.mjs.map +1 -0
- package/dist/lib/utilities/write-file.cjs +29 -0
- package/dist/lib/utilities/write-file.cjs.map +1 -0
- package/dist/lib/utilities/write-file.d.cts +16 -0
- package/dist/lib/utilities/write-file.d.cts.map +1 -0
- package/dist/lib/utilities/write-file.d.mts +16 -0
- package/dist/lib/utilities/write-file.d.mts.map +1 -0
- package/dist/lib/utilities/write-file.mjs +28 -0
- package/dist/lib/utilities/write-file.mjs.map +1 -0
- package/dist/plugin-base.cjs +73 -0
- package/dist/plugin-base.cjs.map +1 -0
- package/dist/plugin-base.d.cts +27 -0
- package/dist/plugin-base.d.cts.map +1 -0
- package/dist/plugin-base.d.mts +27 -0
- package/dist/plugin-base.d.mts.map +1 -0
- package/dist/plugin-base.mjs +70 -0
- package/dist/plugin-base.mjs.map +1 -0
- package/dist/plugin-utils/build-helpers.cjs +36 -0
- package/dist/plugin-utils/build-helpers.cjs.map +1 -0
- package/dist/plugin-utils/build-helpers.d.cts +19 -0
- package/dist/plugin-utils/build-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/build-helpers.d.mts +19 -0
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/build-helpers.mjs +35 -0
- package/dist/plugin-utils/build-helpers.mjs.map +1 -0
- package/dist/plugin-utils/context-helpers.cjs +50 -0
- package/dist/plugin-utils/context-helpers.cjs.map +1 -0
- package/dist/plugin-utils/context-helpers.d.cts +21 -0
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/context-helpers.d.mts +21 -0
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/context-helpers.mjs +48 -0
- package/dist/plugin-utils/context-helpers.mjs.map +1 -0
- package/dist/plugin-utils/extend.cjs +25 -0
- package/dist/plugin-utils/extend.cjs.map +1 -0
- package/dist/plugin-utils/extend.d.cts +20 -0
- package/dist/plugin-utils/extend.d.cts.map +1 -0
- package/dist/plugin-utils/extend.d.mts +20 -0
- package/dist/plugin-utils/extend.d.mts.map +1 -0
- package/dist/plugin-utils/extend.mjs +24 -0
- package/dist/plugin-utils/extend.mjs.map +1 -0
- package/dist/plugin-utils/format-package-json.cjs +20 -0
- package/dist/plugin-utils/format-package-json.cjs.map +1 -0
- package/dist/plugin-utils/format-package-json.d.cts +13 -0
- package/dist/plugin-utils/format-package-json.d.cts.map +1 -0
- package/dist/plugin-utils/format-package-json.d.mts +13 -0
- package/dist/plugin-utils/format-package-json.d.mts.map +1 -0
- package/dist/plugin-utils/format-package-json.mjs +19 -0
- package/dist/plugin-utils/format-package-json.mjs.map +1 -0
- package/dist/plugin-utils/get-config-path.cjs +50 -0
- package/dist/plugin-utils/get-config-path.cjs.map +1 -0
- package/dist/plugin-utils/get-config-path.d.cts +15 -0
- package/dist/plugin-utils/get-config-path.d.cts.map +1 -0
- package/dist/plugin-utils/get-config-path.d.mts +15 -0
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -0
- package/dist/plugin-utils/get-config-path.mjs +49 -0
- package/dist/plugin-utils/get-config-path.mjs.map +1 -0
- package/dist/plugin-utils/helpers.cjs +185 -0
- package/dist/plugin-utils/helpers.cjs.map +1 -0
- package/dist/plugin-utils/helpers.d.cts +144 -0
- package/dist/plugin-utils/helpers.d.cts.map +1 -0
- package/dist/plugin-utils/helpers.d.mts +144 -0
- package/dist/plugin-utils/helpers.d.mts.map +1 -0
- package/dist/plugin-utils/helpers.mjs +170 -0
- package/dist/plugin-utils/helpers.mjs.map +1 -0
- package/dist/plugin-utils/index.cjs +35 -0
- package/dist/plugin-utils/index.d.cts +10 -0
- package/dist/plugin-utils/index.d.mts +10 -0
- package/dist/plugin-utils/index.mjs +11 -0
- package/dist/plugin-utils/merge.cjs +60 -0
- package/dist/plugin-utils/merge.cjs.map +1 -0
- package/dist/plugin-utils/merge.d.cts +35 -0
- package/dist/plugin-utils/merge.d.cts.map +1 -0
- package/dist/plugin-utils/merge.d.mts +35 -0
- package/dist/plugin-utils/merge.d.mts.map +1 -0
- package/dist/plugin-utils/merge.mjs +57 -0
- package/dist/plugin-utils/merge.mjs.map +1 -0
- package/dist/plugin-utils/modules.cjs +17 -0
- package/dist/plugin-utils/modules.cjs.map +1 -0
- package/dist/plugin-utils/modules.d.cts +15 -0
- package/dist/plugin-utils/modules.d.cts.map +1 -0
- package/dist/plugin-utils/modules.d.mts +15 -0
- package/dist/plugin-utils/modules.d.mts.map +1 -0
- package/dist/plugin-utils/modules.mjs +16 -0
- package/dist/plugin-utils/modules.mjs.map +1 -0
- package/dist/plugin-utils/paths.cjs +38 -0
- package/dist/plugin-utils/paths.cjs.map +1 -0
- package/dist/plugin-utils/paths.d.cts +34 -0
- package/dist/plugin-utils/paths.d.cts.map +1 -0
- package/dist/plugin-utils/paths.d.mts +34 -0
- package/dist/plugin-utils/paths.d.mts.map +1 -0
- package/dist/plugin-utils/paths.mjs +37 -0
- package/dist/plugin-utils/paths.mjs.map +1 -0
- package/dist/types/_internal.cjs +0 -0
- package/dist/types/_internal.d.cts +107 -0
- package/dist/types/_internal.d.cts.map +1 -0
- package/dist/types/_internal.d.mts +107 -0
- package/dist/types/_internal.d.mts.map +1 -0
- package/dist/types/_internal.mjs +1 -0
- package/dist/types/api.cjs +0 -0
- package/dist/types/api.d.cts +104 -0
- package/dist/types/api.d.cts.map +1 -0
- package/dist/types/api.d.mts +104 -0
- package/dist/types/api.d.mts.map +1 -0
- package/dist/types/api.mjs +1 -0
- package/dist/types/commands.cjs +17 -0
- package/dist/types/commands.cjs.map +1 -0
- package/dist/types/commands.d.cts +13 -0
- package/dist/types/commands.d.cts.map +1 -0
- package/dist/types/commands.d.mts +13 -0
- package/dist/types/commands.d.mts.map +1 -0
- package/dist/types/commands.mjs +16 -0
- package/dist/types/commands.mjs.map +1 -0
- package/dist/types/config.cjs +0 -0
- package/dist/types/config.d.cts +617 -0
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/config.d.mts +617 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +1 -0
- package/dist/types/context.cjs +0 -0
- package/dist/types/context.d.cts +564 -0
- package/dist/types/context.d.cts.map +1 -0
- package/dist/types/context.d.mts +564 -0
- package/dist/types/context.d.mts.map +1 -0
- package/dist/types/context.mjs +1 -0
- package/dist/types/fs.cjs +11 -0
- package/dist/types/fs.cjs.map +1 -0
- package/dist/types/fs.d.cts +502 -0
- package/dist/types/fs.d.cts.map +1 -0
- package/dist/types/fs.d.mts +502 -0
- package/dist/types/fs.d.mts.map +1 -0
- package/dist/types/fs.mjs +8 -0
- package/dist/types/fs.mjs.map +1 -0
- package/dist/types/hooks.cjs +13 -0
- package/dist/types/hooks.cjs.map +1 -0
- package/dist/types/hooks.d.cts +117 -0
- package/dist/types/hooks.d.cts.map +1 -0
- package/dist/types/hooks.d.mts +117 -0
- package/dist/types/hooks.d.mts.map +1 -0
- package/dist/types/hooks.mjs +12 -0
- package/dist/types/hooks.mjs.map +1 -0
- package/dist/types/index.cjs +16 -0
- package/dist/types/index.d.cts +10 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.mjs +7 -0
- package/dist/types/plugin.cjs +35 -0
- package/dist/types/plugin.cjs.map +1 -0
- package/dist/types/plugin.d.cts +218 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +218 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +33 -0
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/tsconfig.cjs +0 -0
- package/dist/types/tsconfig.d.cts +77 -0
- package/dist/types/tsconfig.d.cts.map +1 -0
- package/dist/types/tsconfig.d.mts +77 -0
- package/dist/types/tsconfig.d.mts.map +1 -0
- package/dist/types/tsconfig.mjs +1 -0
- package/dist/types/unplugin.cjs +24 -0
- package/dist/types/unplugin.cjs.map +1 -0
- package/dist/types/unplugin.d.cts +41 -0
- package/dist/types/unplugin.d.cts.map +1 -0
- package/dist/types/unplugin.d.mts +41 -0
- package/dist/types/unplugin.d.mts.map +1 -0
- package/dist/types/unplugin.mjs +22 -0
- package/dist/types/unplugin.mjs.map +1 -0
- package/package.json +238 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LogFn } from "../../types/config.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/utilities/write-file.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Writes and formats a file to the file system
|
|
7
|
+
*
|
|
8
|
+
* @param log - The logging function to use for logging errors
|
|
9
|
+
* @param filepath - The file path to write the file
|
|
10
|
+
* @param content - The content to write to the file
|
|
11
|
+
* @param skipFormat - Should the plugin skip formatting the `content` string with Prettier
|
|
12
|
+
*/
|
|
13
|
+
declare function writeFile(log: LogFn, filepath: string, content: string, skipFormat?: boolean): Promise<void>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { writeFile };
|
|
16
|
+
//# sourceMappingURL=write-file.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.d.cts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"sourcesContent":[],"mappings":";;;;;;AA+BA;;;;;;iBAAsB,SAAA,MACf,iEAGa"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LogFn } from "../../types/config.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/utilities/write-file.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Writes and formats a file to the file system
|
|
7
|
+
*
|
|
8
|
+
* @param log - The logging function to use for logging errors
|
|
9
|
+
* @param filepath - The file path to write the file
|
|
10
|
+
* @param content - The content to write to the file
|
|
11
|
+
* @param skipFormat - Should the plugin skip formatting the `content` string with Prettier
|
|
12
|
+
*/
|
|
13
|
+
declare function writeFile(log: LogFn, filepath: string, content: string, skipFormat?: boolean): Promise<void>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { writeFile };
|
|
16
|
+
//# sourceMappingURL=write-file.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.d.mts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"sourcesContent":[],"mappings":";;;;;;AA+BA;;;;;;iBAAsB,SAAA,MACf,iEAGa"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
2
|
+
import { format, resolveConfig } from "prettier";
|
|
3
|
+
import { writeFile as writeFile$1 } from "@stryke/fs/write-file";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/utilities/write-file.ts
|
|
6
|
+
/**
|
|
7
|
+
* Writes and formats a file to the file system
|
|
8
|
+
*
|
|
9
|
+
* @param log - The logging function to use for logging errors
|
|
10
|
+
* @param filepath - The file path to write the file
|
|
11
|
+
* @param content - The content to write to the file
|
|
12
|
+
* @param skipFormat - Should the plugin skip formatting the `content` string with Prettier
|
|
13
|
+
*/
|
|
14
|
+
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
15
|
+
try {
|
|
16
|
+
if (skipFormat) await writeFile$1(filepath, content);
|
|
17
|
+
else await writeFile$1(filepath, await format(content, {
|
|
18
|
+
...await resolveConfig(filepath) ?? {},
|
|
19
|
+
filepath
|
|
20
|
+
}) || "");
|
|
21
|
+
} catch (error) {
|
|
22
|
+
log(LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk \n${error?.message ? error.message : ""}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { writeFile };
|
|
28
|
+
//# sourceMappingURL=write-file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.mjs","names":["writeFileBase"],"sources":["../../../src/lib/utilities/write-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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { writeFile as writeFileBase } from \"@stryke/fs/write-file\";\nimport { format, resolveConfig } from \"prettier\";\nimport type { LogFn } from \"../../types/config\";\n\n/**\n * Writes and formats a file to the file system\n *\n * @param log - The logging function to use for logging errors\n * @param filepath - The file path to write the file\n * @param content - The content to write to the file\n * @param skipFormat - Should the plugin skip formatting the `content` string with Prettier\n */\nexport async function writeFile(\n log: LogFn,\n filepath: string,\n content: string,\n skipFormat = false\n) {\n try {\n if (skipFormat) {\n await writeFileBase(filepath, content);\n } else {\n const config = await resolveConfig(filepath);\n const formatted = await format(content, {\n ...(config ?? {}),\n filepath\n });\n\n await writeFileBase(filepath, formatted || \"\");\n }\n } catch (error) {\n log(\n LogLevelLabel.ERROR,\n `Failed to write file ${filepath} to disk \\n${(error as Error)?.message ? (error as Error).message : \"\"}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,eAAsB,UACpB,KACA,UACA,SACA,aAAa,OACb;AACA,KAAI;AACF,MAAI,WACF,OAAMA,YAAc,UAAU,QAAQ;MAQtC,OAAMA,YAAc,UALF,MAAM,OAAO,SAAS;GACtC,GAFa,MAAM,cAAc,SAAS,IAE5B,EAAE;GAChB;GACD,CAAC,IAEyC,GAAG;UAEzC,OAAO;AACd,MACE,cAAc,OACd,wBAAwB,SAAS,aAAc,OAAiB,UAAW,MAAgB,UAAU,KACtG"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_plugin_utils_format_package_json = require('./plugin-utils/format-package-json.cjs');
|
|
4
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
5
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
6
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
7
|
+
let tsdown = require("tsdown");
|
|
8
|
+
|
|
9
|
+
//#region src/plugin-base.ts
|
|
10
|
+
/**
|
|
11
|
+
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
12
|
+
*/
|
|
13
|
+
const plugin = (options = {}) => {
|
|
14
|
+
return {
|
|
15
|
+
name: "base",
|
|
16
|
+
config() {
|
|
17
|
+
return {
|
|
18
|
+
projectType: "library",
|
|
19
|
+
input: [
|
|
20
|
+
"src/index.ts",
|
|
21
|
+
"src/types/*.ts",
|
|
22
|
+
"src/helpers/*.ts"
|
|
23
|
+
],
|
|
24
|
+
output: {
|
|
25
|
+
format: ["cjs", "esm"],
|
|
26
|
+
dts: false
|
|
27
|
+
},
|
|
28
|
+
resolve: { external: [
|
|
29
|
+
"powerlines",
|
|
30
|
+
/^powerlines\/.*$/,
|
|
31
|
+
/^@powerlines\//
|
|
32
|
+
] },
|
|
33
|
+
platform: "node",
|
|
34
|
+
tsdown: {
|
|
35
|
+
format: ["cjs", "esm"],
|
|
36
|
+
logLevel: "silent",
|
|
37
|
+
target: "node22",
|
|
38
|
+
cjsDefault: true,
|
|
39
|
+
treeshake: true,
|
|
40
|
+
exports: { all: true },
|
|
41
|
+
fixedExtension: true,
|
|
42
|
+
nodeProtocol: true,
|
|
43
|
+
minify: false,
|
|
44
|
+
dts: true,
|
|
45
|
+
shims: true,
|
|
46
|
+
outDir: "dist",
|
|
47
|
+
clean: true,
|
|
48
|
+
skipNodeModulesBundle: true,
|
|
49
|
+
unbundle: true,
|
|
50
|
+
...options.tsdown
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
async build() {
|
|
55
|
+
await (0, tsdown.build)({
|
|
56
|
+
name: this.config.name,
|
|
57
|
+
cwd: (0, __stryke_path_append.appendPath)(this.config.root, this.workspaceConfig.workspaceRoot),
|
|
58
|
+
entry: this.entry.filter((entry) => entry?.file).length > 0 ? Object.fromEntries(this.entry.filter((entry) => entry?.file).map((entry) => [entry.output || (0, __stryke_path_replace.replaceExtension)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)(entry.file, (0, __stryke_path_join.joinPaths)(this.config.root, "src")), this.entryPath)), entry.file])) : [(0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.root, "src", "**/*.ts"), (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.root, "src", "**/*.tsx")],
|
|
59
|
+
platform: this.config.platform,
|
|
60
|
+
tsconfig: this.tsconfig.tsconfigFilePath,
|
|
61
|
+
outDir: this.config.output.buildPath,
|
|
62
|
+
...this.config.tsdown
|
|
63
|
+
});
|
|
64
|
+
await require_plugin_utils_format_package_json.formatPackageJson(this);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
var plugin_base_default = plugin;
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.default = plugin_base_default;
|
|
72
|
+
exports.plugin = plugin;
|
|
73
|
+
//# sourceMappingURL=plugin-base.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-base.cjs","names":["formatPackageJson"],"sources":["../src/plugin-base.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 { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { build, UserConfig as BuildOptions } from \"tsdown\";\nimport { formatPackageJson } from \"./plugin-utils/format-package-json\";\nimport { ResolvedConfig, UserConfig } from \"./types/config\";\nimport { PluginContext } from \"./types/context\";\nimport { Plugin } from \"./types/plugin\";\n\nexport interface BasePluginOptions {\n tsdown?: Partial<BuildOptions>;\n}\n\nexport type BasePluginUserConfig = UserConfig & {\n tsdown: BasePluginOptions;\n};\n\nexport type BasePluginResolvedConfig = ResolvedConfig & {\n tsdown: Required<BasePluginOptions>;\n};\n\nexport type BasePluginContext<\n TResolvedConfig extends BasePluginResolvedConfig = BasePluginResolvedConfig\n> = PluginContext<TResolvedConfig>;\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends BasePluginContext = BasePluginContext>(\n options: BasePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"base\",\n config() {\n return {\n projectType: \"library\",\n input: [\"src/index.ts\", \"src/types/*.ts\", \"src/helpers/*.ts\"],\n output: {\n format: [\"cjs\", \"esm\"],\n dts: false\n },\n resolve: {\n external: [\"powerlines\", /^powerlines\\/.*$/, /^@powerlines\\//]\n },\n platform: \"node\",\n tsdown: {\n format: [\"cjs\", \"esm\"],\n logLevel: \"silent\",\n target: \"node22\",\n cjsDefault: true,\n treeshake: true,\n exports: {\n all: true\n },\n fixedExtension: true,\n nodeProtocol: true,\n minify: false,\n dts: true,\n shims: true,\n outDir: \"dist\",\n clean: true,\n skipNodeModulesBundle: true,\n unbundle: true,\n ...options.tsdown\n }\n };\n },\n async build() {\n await build({\n name: this.config.name,\n cwd: appendPath(this.config.root, this.workspaceConfig.workspaceRoot),\n entry:\n this.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n this.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(this.config.root, \"src\")\n ),\n this.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n platform: this.config.platform,\n tsconfig: this.tsconfig.tsconfigFilePath,\n outDir: this.config.output.buildPath,\n ...this.config.tsdown\n });\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AA8CA,MAAa,UACX,UAA6B,EAAE,KACV;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,aAAa;IACb,OAAO;KAAC;KAAgB;KAAkB;KAAmB;IAC7D,QAAQ;KACN,QAAQ,CAAC,OAAO,MAAM;KACtB,KAAK;KACN;IACD,SAAS,EACP,UAAU;KAAC;KAAc;KAAoB;KAAiB,EAC/D;IACD,UAAU;IACV,QAAQ;KACN,QAAQ,CAAC,OAAO,MAAM;KACtB,UAAU;KACV,QAAQ;KACR,YAAY;KACZ,WAAW;KACX,SAAS,EACP,KAAK,MACN;KACD,gBAAgB;KAChB,cAAc;KACd,QAAQ;KACR,KAAK;KACL,OAAO;KACP,QAAQ;KACR,OAAO;KACP,uBAAuB;KACvB,UAAU;KACV,GAAG,QAAQ;KACZ;IACF;;EAEH,MAAM,QAAQ;AACZ,2BAAY;IACV,MAAM,KAAK,OAAO;IAClB,0CAAgB,KAAK,OAAO,MAAM,KAAK,gBAAgB,cAAc;IACrE,OACE,KAAK,MAAM,QAAO,UAAS,OAAO,KAAK,CAAC,SAAS,IAC7C,OAAO,YACL,KAAK,MACF,QAAO,UAAS,OAAO,KAAK,CAC5B,KAAI,UAAS,CACZ,MAAM,oIAIE,MAAM,wCACI,KAAK,OAAO,MAAM,MAAM,CACnC,EACD,KAAK,UACN,CACF,EACH,MAAM,KACP,CAAC,CACL,GACD,mCAEI,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,OACA,UACD,oCAEC,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,OACA,WACD,CACF;IACP,UAAU,KAAK,OAAO;IACtB,UAAU,KAAK,SAAS;IACxB,QAAQ,KAAK,OAAO,OAAO;IAC3B,GAAG,KAAK,OAAO;IAChB,CAAC;AAEF,SAAMA,2DAAkB,KAAK;;EAEhC;;AAGH,0BAAe"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from "./types/plugin.cjs";
|
|
2
|
+
import { PluginContext } from "./types/context.cjs";
|
|
3
|
+
import { ResolvedConfig, UserConfig as UserConfig$1 } from "./types/config.cjs";
|
|
4
|
+
import { UserConfig } from "tsdown";
|
|
5
|
+
|
|
6
|
+
//#region src/plugin-base.d.ts
|
|
7
|
+
interface BasePluginOptions {
|
|
8
|
+
tsdown?: Partial<UserConfig>;
|
|
9
|
+
}
|
|
10
|
+
type BasePluginUserConfig = UserConfig$1 & {
|
|
11
|
+
tsdown: BasePluginOptions;
|
|
12
|
+
};
|
|
13
|
+
type BasePluginResolvedConfig = ResolvedConfig & {
|
|
14
|
+
tsdown: Required<BasePluginOptions>;
|
|
15
|
+
};
|
|
16
|
+
type BasePluginContext<TResolvedConfig extends BasePluginResolvedConfig = BasePluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
19
|
+
*/
|
|
20
|
+
declare const plugin: <TContext extends BasePluginContext = BasePluginContext>(options?: BasePluginOptions) => Plugin<TContext>;
|
|
21
|
+
declare type __ΩBasePluginOptions = any[];
|
|
22
|
+
declare type __ΩBasePluginUserConfig = any[];
|
|
23
|
+
declare type __ΩBasePluginResolvedConfig = any[];
|
|
24
|
+
declare type __ΩBasePluginContext = any[];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { BasePluginContext, BasePluginOptions, BasePluginResolvedConfig, BasePluginUserConfig, __ΩBasePluginContext, __ΩBasePluginOptions, __ΩBasePluginResolvedConfig, __ΩBasePluginUserConfig, plugin as default, plugin };
|
|
27
|
+
//# sourceMappingURL=plugin-base.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-base.d.cts","names":[],"sources":["../src/plugin-base.ts"],"sourcesContent":[],"mappings":";;;;;;UA2BiB,iBAAA;WACN,QAAQ;AADnB;AAIY,KAAA,oBAAA,GAAuB,YAAA,GAAA;EAIvB,MAAA,EAHF,iBAGE;CAA2B;AACpB,KADP,wBAAA,GAA2B,cACpB,GAAA;EAAT,MAAA,EAAA,QAAA,CAAS,iBAAT,CAAA;CAAQ;AAGN,KAAA,iBAAiB,CAAA,wBACH,wBADG,GACwB,wBADxB,CAAA,GAEzB,aAFyB,CAEX,eAFW,CAAA;;;;AAEzB,cAKS,MALT,EAAA,CAAA,iBAKoC,iBALpC,GAKwD,iBALxD,CAAA,CAAA,OAAA,CAAA,EAMO,iBANP,EAAA,GAOD,MAPC,CAOM,QAPN,CAAA;AAKS,oCAqFZ,GAAA,EAAA;AArFuC,uCAAA,GAAA,EAAA;AAAoB,2CAAA,GAAA,EAAA;AACjD,oCAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from "./types/plugin.mjs";
|
|
2
|
+
import { PluginContext } from "./types/context.mjs";
|
|
3
|
+
import { ResolvedConfig, UserConfig as UserConfig$1 } from "./types/config.mjs";
|
|
4
|
+
import { UserConfig } from "tsdown";
|
|
5
|
+
|
|
6
|
+
//#region src/plugin-base.d.ts
|
|
7
|
+
interface BasePluginOptions {
|
|
8
|
+
tsdown?: Partial<UserConfig>;
|
|
9
|
+
}
|
|
10
|
+
type BasePluginUserConfig = UserConfig$1 & {
|
|
11
|
+
tsdown: BasePluginOptions;
|
|
12
|
+
};
|
|
13
|
+
type BasePluginResolvedConfig = ResolvedConfig & {
|
|
14
|
+
tsdown: Required<BasePluginOptions>;
|
|
15
|
+
};
|
|
16
|
+
type BasePluginContext<TResolvedConfig extends BasePluginResolvedConfig = BasePluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
19
|
+
*/
|
|
20
|
+
declare const plugin: <TContext extends BasePluginContext = BasePluginContext>(options?: BasePluginOptions) => Plugin<TContext>;
|
|
21
|
+
declare type __ΩBasePluginOptions = any[];
|
|
22
|
+
declare type __ΩBasePluginUserConfig = any[];
|
|
23
|
+
declare type __ΩBasePluginResolvedConfig = any[];
|
|
24
|
+
declare type __ΩBasePluginContext = any[];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { BasePluginContext, BasePluginOptions, BasePluginResolvedConfig, BasePluginUserConfig, __ΩBasePluginContext, __ΩBasePluginOptions, __ΩBasePluginResolvedConfig, __ΩBasePluginUserConfig, plugin as default, plugin };
|
|
27
|
+
//# sourceMappingURL=plugin-base.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-base.d.mts","names":[],"sources":["../src/plugin-base.ts"],"sourcesContent":[],"mappings":";;;;;;UA2BiB,iBAAA;WACN,QAAQ;AADnB;AAIY,KAAA,oBAAA,GAAuB,YAAA,GAAA;EAIvB,MAAA,EAHF,iBAGE;CAA2B;AACpB,KADP,wBAAA,GAA2B,cACpB,GAAA;EAAT,MAAA,EAAA,QAAA,CAAS,iBAAT,CAAA;CAAQ;AAGN,KAAA,iBAAiB,CAAA,wBACH,wBADG,GACwB,wBADxB,CAAA,GAEzB,aAFyB,CAEX,eAFW,CAAA;;;;AAEzB,cAKS,MALT,EAAA,CAAA,iBAKoC,iBALpC,GAKwD,iBALxD,CAAA,CAAA,OAAA,CAAA,EAMO,iBANP,EAAA,GAOD,MAPC,CAOM,QAPN,CAAA;AAKS,oCAqFZ,GAAA,EAAA;AArFuC,uCAAA,GAAA,EAAA;AAAoB,2CAAA,GAAA,EAAA;AACjD,oCAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { formatPackageJson } from "./plugin-utils/format-package-json.mjs";
|
|
2
|
+
import { appendPath } from "@stryke/path/append";
|
|
3
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
4
|
+
import { joinPaths } from "@stryke/path/join";
|
|
5
|
+
import { build } from "tsdown";
|
|
6
|
+
|
|
7
|
+
//#region src/plugin-base.ts
|
|
8
|
+
/**
|
|
9
|
+
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
10
|
+
*/
|
|
11
|
+
const plugin = (options = {}) => {
|
|
12
|
+
return {
|
|
13
|
+
name: "base",
|
|
14
|
+
config() {
|
|
15
|
+
return {
|
|
16
|
+
projectType: "library",
|
|
17
|
+
input: [
|
|
18
|
+
"src/index.ts",
|
|
19
|
+
"src/types/*.ts",
|
|
20
|
+
"src/helpers/*.ts"
|
|
21
|
+
],
|
|
22
|
+
output: {
|
|
23
|
+
format: ["cjs", "esm"],
|
|
24
|
+
dts: false
|
|
25
|
+
},
|
|
26
|
+
resolve: { external: [
|
|
27
|
+
"powerlines",
|
|
28
|
+
/^powerlines\/.*$/,
|
|
29
|
+
/^@powerlines\//
|
|
30
|
+
] },
|
|
31
|
+
platform: "node",
|
|
32
|
+
tsdown: {
|
|
33
|
+
format: ["cjs", "esm"],
|
|
34
|
+
logLevel: "silent",
|
|
35
|
+
target: "node22",
|
|
36
|
+
cjsDefault: true,
|
|
37
|
+
treeshake: true,
|
|
38
|
+
exports: { all: true },
|
|
39
|
+
fixedExtension: true,
|
|
40
|
+
nodeProtocol: true,
|
|
41
|
+
minify: false,
|
|
42
|
+
dts: true,
|
|
43
|
+
shims: true,
|
|
44
|
+
outDir: "dist",
|
|
45
|
+
clean: true,
|
|
46
|
+
skipNodeModulesBundle: true,
|
|
47
|
+
unbundle: true,
|
|
48
|
+
...options.tsdown
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
async build() {
|
|
53
|
+
await build({
|
|
54
|
+
name: this.config.name,
|
|
55
|
+
cwd: appendPath(this.config.root, this.workspaceConfig.workspaceRoot),
|
|
56
|
+
entry: this.entry.filter((entry) => entry?.file).length > 0 ? Object.fromEntries(this.entry.filter((entry) => entry?.file).map((entry) => [entry.output || replaceExtension(replacePath(replacePath(entry.file, joinPaths(this.config.root, "src")), this.entryPath)), entry.file])) : [joinPaths(this.workspaceConfig.workspaceRoot, this.config.root, "src", "**/*.ts"), joinPaths(this.workspaceConfig.workspaceRoot, this.config.root, "src", "**/*.tsx")],
|
|
57
|
+
platform: this.config.platform,
|
|
58
|
+
tsconfig: this.tsconfig.tsconfigFilePath,
|
|
59
|
+
outDir: this.config.output.buildPath,
|
|
60
|
+
...this.config.tsdown
|
|
61
|
+
});
|
|
62
|
+
await formatPackageJson(this);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
var plugin_base_default = plugin;
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { plugin_base_default as default, plugin };
|
|
70
|
+
//# sourceMappingURL=plugin-base.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-base.mjs","names":[],"sources":["../src/plugin-base.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 { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { build, UserConfig as BuildOptions } from \"tsdown\";\nimport { formatPackageJson } from \"./plugin-utils/format-package-json\";\nimport { ResolvedConfig, UserConfig } from \"./types/config\";\nimport { PluginContext } from \"./types/context\";\nimport { Plugin } from \"./types/plugin\";\n\nexport interface BasePluginOptions {\n tsdown?: Partial<BuildOptions>;\n}\n\nexport type BasePluginUserConfig = UserConfig & {\n tsdown: BasePluginOptions;\n};\n\nexport type BasePluginResolvedConfig = ResolvedConfig & {\n tsdown: Required<BasePluginOptions>;\n};\n\nexport type BasePluginContext<\n TResolvedConfig extends BasePluginResolvedConfig = BasePluginResolvedConfig\n> = PluginContext<TResolvedConfig>;\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends BasePluginContext = BasePluginContext>(\n options: BasePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"base\",\n config() {\n return {\n projectType: \"library\",\n input: [\"src/index.ts\", \"src/types/*.ts\", \"src/helpers/*.ts\"],\n output: {\n format: [\"cjs\", \"esm\"],\n dts: false\n },\n resolve: {\n external: [\"powerlines\", /^powerlines\\/.*$/, /^@powerlines\\//]\n },\n platform: \"node\",\n tsdown: {\n format: [\"cjs\", \"esm\"],\n logLevel: \"silent\",\n target: \"node22\",\n cjsDefault: true,\n treeshake: true,\n exports: {\n all: true\n },\n fixedExtension: true,\n nodeProtocol: true,\n minify: false,\n dts: true,\n shims: true,\n outDir: \"dist\",\n clean: true,\n skipNodeModulesBundle: true,\n unbundle: true,\n ...options.tsdown\n }\n };\n },\n async build() {\n await build({\n name: this.config.name,\n cwd: appendPath(this.config.root, this.workspaceConfig.workspaceRoot),\n entry:\n this.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n this.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(this.config.root, \"src\")\n ),\n this.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n platform: this.config.platform,\n tsconfig: this.tsconfig.tsconfigFilePath,\n outDir: this.config.output.buildPath,\n ...this.config.tsdown\n });\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;AA8CA,MAAa,UACX,UAA6B,EAAE,KACV;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,aAAa;IACb,OAAO;KAAC;KAAgB;KAAkB;KAAmB;IAC7D,QAAQ;KACN,QAAQ,CAAC,OAAO,MAAM;KACtB,KAAK;KACN;IACD,SAAS,EACP,UAAU;KAAC;KAAc;KAAoB;KAAiB,EAC/D;IACD,UAAU;IACV,QAAQ;KACN,QAAQ,CAAC,OAAO,MAAM;KACtB,UAAU;KACV,QAAQ;KACR,YAAY;KACZ,WAAW;KACX,SAAS,EACP,KAAK,MACN;KACD,gBAAgB;KAChB,cAAc;KACd,QAAQ;KACR,KAAK;KACL,OAAO;KACP,QAAQ;KACR,OAAO;KACP,uBAAuB;KACvB,UAAU;KACV,GAAG,QAAQ;KACZ;IACF;;EAEH,MAAM,QAAQ;AACZ,SAAM,MAAM;IACV,MAAM,KAAK,OAAO;IAClB,KAAK,WAAW,KAAK,OAAO,MAAM,KAAK,gBAAgB,cAAc;IACrE,OACE,KAAK,MAAM,QAAO,UAAS,OAAO,KAAK,CAAC,SAAS,IAC7C,OAAO,YACL,KAAK,MACF,QAAO,UAAS,OAAO,KAAK,CAC5B,KAAI,UAAS,CACZ,MAAM,UACJ,iBACE,YACE,YACE,MAAM,MACN,UAAU,KAAK,OAAO,MAAM,MAAM,CACnC,EACD,KAAK,UACN,CACF,EACH,MAAM,KACP,CAAC,CACL,GACD,CACE,UACE,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,OACA,UACD,EACD,UACE,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,OACA,WACD,CACF;IACP,UAAU,KAAK,OAAO;IACtB,UAAU,KAAK,SAAS;IACxB,QAAQ,KAAK,OAAO,OAAO;IAC3B,GAAG,KAAK,OAAO;IAChB,CAAC;AAEF,SAAM,kBAAkB,KAAK;;EAEhC;;AAGH,0BAAe"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
3
|
+
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
4
|
+
let __stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
5
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
|
+
|
|
7
|
+
//#region 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;
|
|
36
|
+
//# sourceMappingURL=build-helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-helpers.cjs","names":[],"sources":["../../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,+FACI,QAAQ,OAAO,QAAQ,WAAW,CAAC,OAAO,QAAQ,SAAS,CACpE;CAED,MAAM,6FACI,QAAQ,OAAO,QAAQ,SAAS,CAAC,QACtC,KAAK,QAAQ;AACZ,mDAAa,IAAI,EAAE;AACjB,OACE,WAAW,MACT,uDAAkB,MAAM,IAAI,MAAM,WAAW,IAAI,OAClD,CAED,QAAO;GAGT,MAAM,SAAS,WAAW,QACxB,8DAAqB,MAAM,IAAI,IAAI,KAAK,MAAM,CAC/C;AACD,OAAI,OAAO,SAAS,GAAG;AACrB,QAAI,KACF,IAAI,OACF,OAAO,QACJ,OAAe,UACd,mDACW,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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "../types/context.cjs";
|
|
2
|
+
import { ResolveConfig } from "../types/config.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/build-helpers.d.ts
|
|
5
|
+
interface GetDependencyConfigResult {
|
|
6
|
+
external: ResolveConfig["external"];
|
|
7
|
+
noExternal: ResolveConfig["noExternal"];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
11
|
+
*
|
|
12
|
+
* @param context - The build context.
|
|
13
|
+
* @returns The dependency configuration.
|
|
14
|
+
*/
|
|
15
|
+
declare function getDependencyConfig(context: Context): GetDependencyConfigResult;
|
|
16
|
+
declare type __ΩGetDependencyConfigResult = any[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GetDependencyConfigResult, __ΩGetDependencyConfigResult, getDependencyConfig };
|
|
19
|
+
//# sourceMappingURL=build-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/build-helpers.ts"],"sourcesContent":[],"mappings":";;;;UAyBiB,yBAAA;YACL;EADK,UAAA,EAEH,aAFG,CAAA,YAAyB,CAAA;AAW1C;;;;;;;iBAAgB,mBAAA,UACL,UACR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "../types/context.mjs";
|
|
2
|
+
import { ResolveConfig } from "../types/config.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/build-helpers.d.ts
|
|
5
|
+
interface GetDependencyConfigResult {
|
|
6
|
+
external: ResolveConfig["external"];
|
|
7
|
+
noExternal: ResolveConfig["noExternal"];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
11
|
+
*
|
|
12
|
+
* @param context - The build context.
|
|
13
|
+
* @returns The dependency configuration.
|
|
14
|
+
*/
|
|
15
|
+
declare function getDependencyConfig(context: Context): GetDependencyConfigResult;
|
|
16
|
+
declare type __ΩGetDependencyConfigResult = any[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GetDependencyConfigResult, __ΩGetDependencyConfigResult, getDependencyConfig };
|
|
19
|
+
//# sourceMappingURL=build-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/build-helpers.ts"],"sourcesContent":[],"mappings":";;;;UAyBiB,yBAAA;YACL;EADK,UAAA,EAEH,aAFG,CAAA,YAAyB,CAAA;AAW1C;;;;;;;iBAAgB,mBAAA,UACL,UACR"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
2
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
3
|
+
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
4
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
5
|
+
|
|
6
|
+
//#region 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-helpers.mjs","names":[],"sources":["../../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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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_set_string = require("@stryke/type-checks/is-set-string");
|
|
4
|
+
|
|
5
|
+
//#region src/plugin-utils/context-helpers.ts
|
|
6
|
+
/**
|
|
7
|
+
* Get the organization name from the context
|
|
8
|
+
*
|
|
9
|
+
* @param context - The Powerlines plugin context.
|
|
10
|
+
* @returns The organization name or undefined if not found.
|
|
11
|
+
*/
|
|
12
|
+
function getOrganizationName(context) {
|
|
13
|
+
let result;
|
|
14
|
+
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.workspaceConfig.organization)) result = context.workspaceConfig.organization.name;
|
|
15
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.organization)) result = context.workspaceConfig.organization;
|
|
16
|
+
if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
|
|
17
|
+
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0].name;
|
|
18
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
|
|
19
|
+
}
|
|
20
|
+
if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
|
|
21
|
+
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.author[0])) result = context.packageJson.author[0].name;
|
|
22
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.author[0])) result = context.packageJson.author[0];
|
|
23
|
+
}
|
|
24
|
+
if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
|
|
25
|
+
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.contributors[0])) result = context.packageJson.contributors[0].name;
|
|
26
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.contributors[0])) result = context.packageJson.contributors[0];
|
|
27
|
+
}
|
|
28
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
29
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the organization name from the context
|
|
34
|
+
*
|
|
35
|
+
* @param context - The Powerlines plugin context.
|
|
36
|
+
* @returns The organization name or undefined if not found.
|
|
37
|
+
*/
|
|
38
|
+
function getWorkspaceName(context) {
|
|
39
|
+
let result;
|
|
40
|
+
if ((0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.name)) result = context.workspaceConfig.name;
|
|
41
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.namespace)) result = context.workspaceConfig.namespace.replace(/^@/, "");
|
|
42
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
43
|
+
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.getOrganizationName = getOrganizationName;
|
|
49
|
+
exports.getWorkspaceName = getWorkspaceName;
|
|
50
|
+
//# sourceMappingURL=context-helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.cjs","names":["result: string | undefined"],"sources":["../../src/plugin-utils/context-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 { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getOrganizationName(\n context: UnresolvedContext\n): string | undefined {\n let result: string | undefined;\n if (isSetObject(context.workspaceConfig.organization)) {\n result = context.workspaceConfig.organization.name;\n }\n\n if (!result && isSetString(context.workspaceConfig.organization)) {\n result = context.workspaceConfig.organization;\n }\n\n if (\n !result &&\n Array.isArray(context.packageJson.maintainers) &&\n context.packageJson.maintainers.length > 0\n ) {\n if (isSetObject(context.packageJson.maintainers[0])) {\n result = (context.packageJson.maintainers[0] as { name: string }).name;\n }\n\n if (!result && isSetString(context.packageJson.maintainers[0])) {\n result = context.packageJson.maintainers[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(context.packageJson.author) &&\n context.packageJson.author.length > 0\n ) {\n if (isSetObject(context.packageJson.author[0])) {\n result = (context.packageJson.author[0] as { name: string }).name;\n }\n\n if (!result && isSetString(context.packageJson.author[0])) {\n result = context.packageJson.author[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(context.packageJson.contributors) &&\n context.packageJson.contributors.length > 0\n ) {\n if (isSetObject(context.packageJson.contributors[0])) {\n result = (context.packageJson.contributors[0] as { name: string }).name;\n }\n\n if (!result && isSetString(context.packageJson.contributors[0])) {\n result = context.packageJson.contributors[0];\n }\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getWorkspaceName(\n context: UnresolvedContext\n): string | undefined {\n let result: string | undefined;\n if (isSetString(context.workspaceConfig.name)) {\n result = context.workspaceConfig.name;\n }\n\n if (!result && isSetString(context.workspaceConfig.namespace)) {\n result = context.workspaceConfig.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,oBACd,SACoB;CACpB,IAAIA;AACJ,yDAAgB,QAAQ,gBAAgB,aAAa,CACnD,UAAS,QAAQ,gBAAgB,aAAa;AAGhD,KAAI,CAAC,8DAAsB,QAAQ,gBAAgB,aAAa,CAC9D,UAAS,QAAQ,gBAAgB;AAGnC,KACE,CAAC,UACD,MAAM,QAAQ,QAAQ,YAAY,YAAY,IAC9C,QAAQ,YAAY,YAAY,SAAS,GACzC;AACA,0DAAgB,QAAQ,YAAY,YAAY,GAAG,CACjD,UAAU,QAAQ,YAAY,YAAY,GAAwB;AAGpE,MAAI,CAAC,8DAAsB,QAAQ,YAAY,YAAY,GAAG,CAC5D,UAAS,QAAQ,YAAY,YAAY;;AAI7C,KACE,CAAC,UACD,MAAM,QAAQ,QAAQ,YAAY,OAAO,IACzC,QAAQ,YAAY,OAAO,SAAS,GACpC;AACA,0DAAgB,QAAQ,YAAY,OAAO,GAAG,CAC5C,UAAU,QAAQ,YAAY,OAAO,GAAwB;AAG/D,MAAI,CAAC,8DAAsB,QAAQ,YAAY,OAAO,GAAG,CACvD,UAAS,QAAQ,YAAY,OAAO;;AAIxC,KACE,CAAC,UACD,MAAM,QAAQ,QAAQ,YAAY,aAAa,IAC/C,QAAQ,YAAY,aAAa,SAAS,GAC1C;AACA,0DAAgB,QAAQ,YAAY,aAAa,GAAG,CAClD,UAAU,QAAQ,YAAY,aAAa,GAAwB;AAGrE,MAAI,CAAC,8DAAsB,QAAQ,YAAY,aAAa,GAAG,CAC7D,UAAS,QAAQ,YAAY,aAAa;;AAI9C,KAAI,CAAC,8DAAsB,QAAQ,YAAY,UAAU,CACvD,UAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,GAAG;AAG1D,KAAI,CAAC,8DAAsB,QAAQ,YAAY,KAAK,CAClD,UAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAG1E,QAAO;;;;;;;;AAST,SAAgB,iBACd,SACoB;CACpB,IAAIA;AACJ,yDAAgB,QAAQ,gBAAgB,KAAK,CAC3C,UAAS,QAAQ,gBAAgB;AAGnC,KAAI,CAAC,8DAAsB,QAAQ,gBAAgB,UAAU,CAC3D,UAAS,QAAQ,gBAAgB,UAAU,QAAQ,MAAM,GAAG;AAG9D,KAAI,CAAC,8DAAsB,QAAQ,YAAY,UAAU,CACvD,UAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,GAAG;AAG1D,KAAI,CAAC,8DAAsB,QAAQ,YAAY,KAAK,CAClD,UAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAG1E,QAAO"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UnresolvedContext } from "../types/context.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/context-helpers.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the organization name from the context
|
|
7
|
+
*
|
|
8
|
+
* @param context - The Powerlines plugin context.
|
|
9
|
+
* @returns The organization name or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
declare function getOrganizationName(context: UnresolvedContext): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get the organization name from the context
|
|
14
|
+
*
|
|
15
|
+
* @param context - The Powerlines plugin context.
|
|
16
|
+
* @returns The organization name or undefined if not found.
|
|
17
|
+
*/
|
|
18
|
+
declare function getWorkspaceName(context: UnresolvedContext): string | undefined;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getOrganizationName, getWorkspaceName };
|
|
21
|
+
//# sourceMappingURL=context-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;AA4BA;AAuEA;;;iBAvEgB,mBAAA,UACL;;;;;;;iBAsEK,gBAAA,UACL"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UnresolvedContext } from "../types/context.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/context-helpers.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the organization name from the context
|
|
7
|
+
*
|
|
8
|
+
* @param context - The Powerlines plugin context.
|
|
9
|
+
* @returns The organization name or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
declare function getOrganizationName(context: UnresolvedContext): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get the organization name from the context
|
|
14
|
+
*
|
|
15
|
+
* @param context - The Powerlines plugin context.
|
|
16
|
+
* @returns The organization name or undefined if not found.
|
|
17
|
+
*/
|
|
18
|
+
declare function getWorkspaceName(context: UnresolvedContext): string | undefined;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getOrganizationName, getWorkspaceName };
|
|
21
|
+
//# sourceMappingURL=context-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;AA4BA;AAuEA;;;iBAvEgB,mBAAA,UACL;;;;;;;iBAsEK,gBAAA,UACL"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/context-helpers.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get the organization name from the context
|
|
7
|
+
*
|
|
8
|
+
* @param context - The Powerlines plugin context.
|
|
9
|
+
* @returns The organization name or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
function getOrganizationName(context) {
|
|
12
|
+
let result;
|
|
13
|
+
if (isSetObject(context.workspaceConfig.organization)) result = context.workspaceConfig.organization.name;
|
|
14
|
+
if (!result && isSetString(context.workspaceConfig.organization)) result = context.workspaceConfig.organization;
|
|
15
|
+
if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
|
|
16
|
+
if (isSetObject(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0].name;
|
|
17
|
+
if (!result && isSetString(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
|
|
18
|
+
}
|
|
19
|
+
if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
|
|
20
|
+
if (isSetObject(context.packageJson.author[0])) result = context.packageJson.author[0].name;
|
|
21
|
+
if (!result && isSetString(context.packageJson.author[0])) result = context.packageJson.author[0];
|
|
22
|
+
}
|
|
23
|
+
if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
|
|
24
|
+
if (isSetObject(context.packageJson.contributors[0])) result = context.packageJson.contributors[0].name;
|
|
25
|
+
if (!result && isSetString(context.packageJson.contributors[0])) result = context.packageJson.contributors[0];
|
|
26
|
+
}
|
|
27
|
+
if (!result && isSetString(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
28
|
+
if (!result && isSetString(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the organization name from the context
|
|
33
|
+
*
|
|
34
|
+
* @param context - The Powerlines plugin context.
|
|
35
|
+
* @returns The organization name or undefined if not found.
|
|
36
|
+
*/
|
|
37
|
+
function getWorkspaceName(context) {
|
|
38
|
+
let result;
|
|
39
|
+
if (isSetString(context.workspaceConfig.name)) result = context.workspaceConfig.name;
|
|
40
|
+
if (!result && isSetString(context.workspaceConfig.namespace)) result = context.workspaceConfig.namespace.replace(/^@/, "");
|
|
41
|
+
if (!result && isSetString(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
42
|
+
if (!result && isSetString(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { getOrganizationName, getWorkspaceName };
|
|
48
|
+
//# sourceMappingURL=context-helpers.mjs.map
|