@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,86 @@
|
|
|
1
|
+
import { getWorkspaceConfig } from "@storm-software/config-tools/get-config";
|
|
2
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
3
|
+
import { appendPath } from "@stryke/path/append";
|
|
4
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
5
|
+
import { replacePath } from "@stryke/path/replace";
|
|
6
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
7
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
8
|
+
import { loadConfig } from "c12";
|
|
9
|
+
import defu$1 from "defu";
|
|
10
|
+
|
|
11
|
+
//#region src/lib/config.ts
|
|
12
|
+
/**
|
|
13
|
+
* Loads the workspace configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param workspaceRoot - The root directory of the workspace.
|
|
16
|
+
* @param cwd - The current working directory to start searching from.
|
|
17
|
+
* @returns A promise that resolves to the loaded workspace configuration.
|
|
18
|
+
*/
|
|
19
|
+
async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
20
|
+
return defu$1({ workspaceRoot }, await getWorkspaceConfig(true, {
|
|
21
|
+
cwd,
|
|
22
|
+
workspaceRoot,
|
|
23
|
+
useDefault: true
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Loads the user configuration file for the project.
|
|
28
|
+
*
|
|
29
|
+
* @param projectRoot - The root directory of the project.
|
|
30
|
+
* @param workspaceRoot - The root directory of the workspace.
|
|
31
|
+
* @param jiti - An instance of Jiti to resolve modules from
|
|
32
|
+
* @param command - The {@link PowerlinesCommand} string associated with the current running process
|
|
33
|
+
* @param mode - The mode in which the project is running (default is "production").
|
|
34
|
+
* @param configFile - An optional path to a specific configuration file.
|
|
35
|
+
* @param framework - The framework name to use for default configuration file names.
|
|
36
|
+
* @returns A promise that resolves to the resolved user configuration.
|
|
37
|
+
*/
|
|
38
|
+
async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mode = "production", configFile, framework = "powerlines") {
|
|
39
|
+
let resolvedUserConfig = {};
|
|
40
|
+
let resolvedUserConfigFile;
|
|
41
|
+
if (configFile) resolvedUserConfigFile = existsSync(replacePath(configFile, projectRoot)) ? replacePath(configFile, projectRoot) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), replacePath(configFile, projectRoot))) ? joinPaths(appendPath(projectRoot, workspaceRoot), replacePath(configFile, projectRoot)) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), configFile)) ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile) : void 0;
|
|
42
|
+
if (!resolvedUserConfigFile) resolvedUserConfigFile = existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.js`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.js`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`) : void 0;
|
|
43
|
+
if (resolvedUserConfigFile) {
|
|
44
|
+
const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));
|
|
45
|
+
if (resolved) {
|
|
46
|
+
let config = {};
|
|
47
|
+
if (isFunction(resolved)) config = await Promise.resolve(resolved({
|
|
48
|
+
command,
|
|
49
|
+
mode,
|
|
50
|
+
isSsrBuild: false,
|
|
51
|
+
isPreview: false
|
|
52
|
+
}));
|
|
53
|
+
if (isSetObject(config)) resolvedUserConfig = {
|
|
54
|
+
...config,
|
|
55
|
+
config,
|
|
56
|
+
configFile: resolvedUserConfigFile
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const result = await loadConfig({
|
|
61
|
+
cwd: projectRoot,
|
|
62
|
+
name: framework,
|
|
63
|
+
envName: mode,
|
|
64
|
+
globalRc: true,
|
|
65
|
+
packageJson: true,
|
|
66
|
+
dotenv: true,
|
|
67
|
+
jiti
|
|
68
|
+
});
|
|
69
|
+
return defu$1(resolvedUserConfig, isSetObject(result?.config) ? {
|
|
70
|
+
...result.config,
|
|
71
|
+
...result
|
|
72
|
+
} : {});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A type helper to make it easier to use `powerlines.config.ts` files.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* The function accepts a direct {@link AnyUserConfig} object and returns it typed as a {@link UserConfig} object.
|
|
79
|
+
*/
|
|
80
|
+
function defineConfig(config) {
|
|
81
|
+
return config;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { defineConfig, loadUserConfigFile, loadWorkspaceConfig };
|
|
86
|
+
//# sourceMappingURL=config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["defu","resolvedUserConfig: Partial<ParsedUserConfig>","resolvedUserConfigFile: string | undefined","loadConfigC12"],"sources":["../../src/lib/config.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 { getWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport type { Jiti } from \"jiti\";\nimport type {\n ParsedUserConfig,\n PowerlinesCommand,\n UserConfig,\n WorkspaceConfig\n} from \"../types/config\";\nimport { AnyUserConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param cwd - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n workspaceRoot: string,\n cwd: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot\n },\n await getWorkspaceConfig(true, {\n cwd,\n workspaceRoot,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param projectRoot - The root directory of the project.\n * @param workspaceRoot - The root directory of the workspace.\n * @param jiti - An instance of Jiti to resolve modules from\n * @param command - The {@link PowerlinesCommand} string associated with the current running process\n * @param mode - The mode in which the project is running (default is \"production\").\n * @param configFile - An optional path to a specific configuration file.\n * @param framework - The framework name to use for default configuration file names.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n projectRoot: string,\n workspaceRoot: string,\n jiti: Jiti,\n command?: PowerlinesCommand,\n mode = \"production\",\n configFile?: string,\n framework = \"powerlines\"\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, projectRoot))\n ? replacePath(configFile, projectRoot)\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n : existsSync(\n joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n )\n ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));\n if (resolved) {\n let config = {};\n if (isFunction(resolved)) {\n config = await Promise.resolve(\n resolved({\n command,\n mode,\n isSsrBuild: false,\n isPreview: false\n })\n );\n }\n\n if (isSetObject(config)) {\n resolvedUserConfig = {\n ...config,\n config: config as UserConfig,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: projectRoot,\n name: framework,\n envName: mode,\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jiti\n });\n\n return defu(\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n ) as ParsedUserConfig;\n}\n\n/**\n * A type helper to make it easier to use `powerlines.config.ts` files.\n *\n * @remarks\n * The function accepts a direct {@link AnyUserConfig} object and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoDA,eAAsB,oBACpB,eACA,KAC0B;AAC1B,QAAOA,OACL,EACE,eACD,EACD,MAAM,mBAAmB,MAAM;EAC7B;EACA;EACA,YAAY;EACb,CAAC,CACH;;;;;;;;;;;;;;AAeH,eAAsB,mBACpB,aACA,eACA,MACA,SACA,OAAO,cACP,YACA,YAAY,cACe;CAC3B,IAAIC,qBAAgD,EAAE;CAEtD,IAAIC;AACJ,KAAI,WACF,0BAAyB,WAAW,YAAY,YAAY,YAAY,CAAC,GACrE,YAAY,YAAY,YAAY,GACpC,WACI,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,GACD,WACI,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,CAC9D,GACD,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,GAC7D;AAGV,KAAI,CAAC,uBACH,0BAAyB,WACvB,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,CACF,GACG,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,GACD;AAGpB,KAAI,wBAAwB;EAC1B,MAAM,WAAW,MAAM,KAAK,OAAO,KAAK,WAAW,uBAAuB,CAAC;AAC3E,MAAI,UAAU;GACZ,IAAI,SAAS,EAAE;AACf,OAAI,WAAW,SAAS,CACtB,UAAS,MAAM,QAAQ,QACrB,SAAS;IACP;IACA;IACA,YAAY;IACZ,WAAW;IACZ,CAAC,CACH;AAGH,OAAI,YAAY,OAAO,CACrB,sBAAqB;IACnB,GAAG;IACK;IACR,YAAY;IACb;;;CAKP,MAAM,SAAS,MAAMC,WAAc;EACjC,KAAK;EACL,MAAM;EACN,SAAS;EACT,UAAU;EACV,aAAa;EACb,QAAQ;EACR;EACD,CAAC;AAEF,QAAOH,OACL,oBACA,YAAY,QAAQ,OAAO,GAAG;EAAE,GAAG,OAAO;EAAQ,GAAG;EAAQ,GAAG,EAAE,CACnE;;;;;;;;AASH,SAAgB,aAAa,QAAmC;AAC9D,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/lib/constants/environments.ts
|
|
3
|
+
const DEFAULT_ENVIRONMENT = "default";
|
|
4
|
+
const GLOBAL_ENVIRONMENT = "__global__";
|
|
5
|
+
const CLIENT_ENVIRONMENT = "client";
|
|
6
|
+
const SERVER_ENVIRONMENT = "server";
|
|
7
|
+
const SSR_ENVIRONMENT = "ssr";
|
|
8
|
+
const RSC_ENVIRONMENT = "rsc";
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.CLIENT_ENVIRONMENT = CLIENT_ENVIRONMENT;
|
|
12
|
+
exports.DEFAULT_ENVIRONMENT = DEFAULT_ENVIRONMENT;
|
|
13
|
+
exports.GLOBAL_ENVIRONMENT = GLOBAL_ENVIRONMENT;
|
|
14
|
+
exports.RSC_ENVIRONMENT = RSC_ENVIRONMENT;
|
|
15
|
+
exports.SERVER_ENVIRONMENT = SERVER_ENVIRONMENT;
|
|
16
|
+
exports.SSR_ENVIRONMENT = SSR_ENVIRONMENT;
|
|
17
|
+
//# sourceMappingURL=environments.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.cjs","names":[],"sources":["../../../src/lib/constants/environments.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\nexport const DEFAULT_ENVIRONMENT = \"default\" as const;\nexport const GLOBAL_ENVIRONMENT = \"__global__\" as const;\n\n// General environment names that can be used in plugins and configurations\nexport const CLIENT_ENVIRONMENT = \"client\" as const;\nexport const SERVER_ENVIRONMENT = \"server\" as const;\nexport const SSR_ENVIRONMENT = \"ssr\" as const;\nexport const RSC_ENVIRONMENT = \"rsc\" as const;\n"],"mappings":";;AAkBA,MAAa,sBAAsB;AACnC,MAAa,qBAAqB;AAGlC,MAAa,qBAAqB;AAClC,MAAa,qBAAqB;AAClC,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/lib/constants/environments.d.ts
|
|
2
|
+
declare const DEFAULT_ENVIRONMENT: "default";
|
|
3
|
+
declare const GLOBAL_ENVIRONMENT: "__global__";
|
|
4
|
+
declare const CLIENT_ENVIRONMENT: "client";
|
|
5
|
+
declare const SERVER_ENVIRONMENT: "server";
|
|
6
|
+
declare const SSR_ENVIRONMENT: "ssr";
|
|
7
|
+
declare const RSC_ENVIRONMENT: "rsc";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
10
|
+
//# sourceMappingURL=environments.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.cts","names":[],"sources":["../../../src/lib/constants/environments.ts"],"sourcesContent":[],"mappings":";cAkBa;AAAA,cACA,kBADwC,EAAA,YAAA;AACxC,cAGA,kBAH0C,EAAA,QAAA;AAG1C,cACA,kBADsC,EAAA,QAAA;AACtC,cACA,eADsC,EAAA,KAAA;AACtC,cACA,eADgC,EAAA,KAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/lib/constants/environments.d.ts
|
|
2
|
+
declare const DEFAULT_ENVIRONMENT: "default";
|
|
3
|
+
declare const GLOBAL_ENVIRONMENT: "__global__";
|
|
4
|
+
declare const CLIENT_ENVIRONMENT: "client";
|
|
5
|
+
declare const SERVER_ENVIRONMENT: "server";
|
|
6
|
+
declare const SSR_ENVIRONMENT: "ssr";
|
|
7
|
+
declare const RSC_ENVIRONMENT: "rsc";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
10
|
+
//# sourceMappingURL=environments.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.mts","names":[],"sources":["../../../src/lib/constants/environments.ts"],"sourcesContent":[],"mappings":";cAkBa;AAAA,cACA,kBADwC,EAAA,YAAA;AACxC,cAGA,kBAH0C,EAAA,QAAA;AAG1C,cACA,kBADsC,EAAA,QAAA;AACtC,cACA,eADsC,EAAA,KAAA;AACtC,cACA,eADgC,EAAA,KAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/lib/constants/environments.ts
|
|
2
|
+
const DEFAULT_ENVIRONMENT = "default";
|
|
3
|
+
const GLOBAL_ENVIRONMENT = "__global__";
|
|
4
|
+
const CLIENT_ENVIRONMENT = "client";
|
|
5
|
+
const SERVER_ENVIRONMENT = "server";
|
|
6
|
+
const SSR_ENVIRONMENT = "ssr";
|
|
7
|
+
const RSC_ENVIRONMENT = "rsc";
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
11
|
+
//# sourceMappingURL=environments.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.mjs","names":[],"sources":["../../../src/lib/constants/environments.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\nexport const DEFAULT_ENVIRONMENT = \"default\" as const;\nexport const GLOBAL_ENVIRONMENT = \"__global__\" as const;\n\n// General environment names that can be used in plugins and configurations\nexport const CLIENT_ENVIRONMENT = \"client\" as const;\nexport const SERVER_ENVIRONMENT = \"server\" as const;\nexport const SSR_ENVIRONMENT = \"ssr\" as const;\nexport const RSC_ENVIRONMENT = \"rsc\" as const;\n"],"mappings":";AAkBA,MAAa,sBAAsB;AACnC,MAAa,qBAAqB;AAGlC,MAAa,qBAAqB;AAClC,MAAa,qBAAqB;AAClC,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_lib_constants_environments = require('./environments.cjs');
|
|
2
|
+
const require_lib_constants_meta = require('./meta.cjs');
|
|
3
|
+
|
|
4
|
+
exports.CACHE_HASH_LENGTH = require_lib_constants_meta.CACHE_HASH_LENGTH;
|
|
5
|
+
exports.CLIENT_ENVIRONMENT = require_lib_constants_environments.CLIENT_ENVIRONMENT;
|
|
6
|
+
exports.DEFAULT_ENVIRONMENT = require_lib_constants_environments.DEFAULT_ENVIRONMENT;
|
|
7
|
+
exports.GLOBAL_ENVIRONMENT = require_lib_constants_environments.GLOBAL_ENVIRONMENT;
|
|
8
|
+
exports.ROOT_HASH_LENGTH = require_lib_constants_meta.ROOT_HASH_LENGTH;
|
|
9
|
+
exports.RSC_ENVIRONMENT = require_lib_constants_environments.RSC_ENVIRONMENT;
|
|
10
|
+
exports.SERVER_ENVIRONMENT = require_lib_constants_environments.SERVER_ENVIRONMENT;
|
|
11
|
+
exports.SSR_ENVIRONMENT = require_lib_constants_environments.SSR_ENVIRONMENT;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./environments.cjs";
|
|
2
|
+
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.cjs";
|
|
3
|
+
export { CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./environments.mjs";
|
|
2
|
+
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.mjs";
|
|
3
|
+
export { CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./environments.mjs";
|
|
2
|
+
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.mjs";
|
|
3
|
+
|
|
4
|
+
export { CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.cjs","names":[],"sources":["../../../src/lib/constants/meta.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\nexport const ROOT_HASH_LENGTH = 45;\nexport const CACHE_HASH_LENGTH = 62;\n"],"mappings":";;AAkBA,MAAa,mBAAmB;AAChC,MAAa,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.cts","names":[],"sources":["../../../src/lib/constants/meta.ts"],"sourcesContent":[],"mappings":";cAkBa,gBAAA;AAAA,cACA,iBAAA,GADgB,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.mts","names":[],"sources":["../../../src/lib/constants/meta.ts"],"sourcesContent":[],"mappings":";cAkBa,gBAAA;AAAA,cACA,iBAAA,GADgB,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/lib/constants/meta.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\nexport const ROOT_HASH_LENGTH = 45;\nexport const CACHE_HASH_LENGTH = 62;\n"],"mappings":";AAkBA,MAAa,mBAAmB;AAChC,MAAa,oBAAoB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_plugin_utils_paths = require('../plugin-utils/paths.cjs');
|
|
3
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
4
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
5
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
6
|
+
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
7
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
8
|
+
let __stryke_hash_murmurhash = require("@stryke/hash/murmurhash");
|
|
9
|
+
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
10
|
+
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
11
|
+
let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
12
|
+
let __stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
13
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
14
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
15
|
+
|
|
16
|
+
//#region src/lib/entry.ts
|
|
17
|
+
function resolveEntryOutput(context, typeDefinition) {
|
|
18
|
+
return (0, __stryke_path_replace.replaceExtension)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)(typeDefinition.file, (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "src")), (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root)), (0, __stryke_path_join_paths.joinPaths)(context.config.root, "src")), context.config.root), "src"));
|
|
19
|
+
}
|
|
20
|
+
function resolveInput(context, typeDefinition, input, output) {
|
|
21
|
+
return {
|
|
22
|
+
...typeDefinition,
|
|
23
|
+
input: (0, __stryke_type_checks_is_set_string.isSetString)(input) || (0, __stryke_type_checks_is_regexp.isRegExp)(input) ? { file: String(input) } : typeDefinition,
|
|
24
|
+
output: output || resolveEntryOutput(context, typeDefinition)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
29
|
+
*
|
|
30
|
+
* @param context - The current context
|
|
31
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
32
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
33
|
+
*/
|
|
34
|
+
async function resolveInputs(context, typeDefinitions) {
|
|
35
|
+
return (await Promise.all(((0, __stryke_type_checks_is_object.isObject)(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, __stryke_convert_to_array.toArray)(typeDefinitions)).map(async (entry) => {
|
|
36
|
+
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
37
|
+
...entry,
|
|
38
|
+
output: entry.output ? require_plugin_utils_paths.replacePathTokens(context, entry.output) : void 0,
|
|
39
|
+
file: require_plugin_utils_paths.replacePathTokens(context, entry.file)
|
|
40
|
+
};
|
|
41
|
+
let typeDefinition;
|
|
42
|
+
if ((0, __stryke_type_checks_is_string.isString)(entry)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(require_plugin_utils_paths.replacePathTokens(context, entry));
|
|
43
|
+
else if ((0, __stryke_type_checks_is_regexp.isRegExp)(entry)) typeDefinition = { file: require_plugin_utils_paths.replacePathTokens(context, entry.source) };
|
|
44
|
+
else {
|
|
45
|
+
typeDefinition = entry;
|
|
46
|
+
typeDefinition.file = require_plugin_utils_paths.replacePathTokens(context, typeDefinition.file);
|
|
47
|
+
}
|
|
48
|
+
const filePath = (0, __stryke_path_is_type.isAbsolutePath)(typeDefinition.file) ? typeDefinition.file : (0, __stryke_path_append.appendPath)(typeDefinition.file, context.config.root);
|
|
49
|
+
if (await context.fs.isFile(filePath)) return resolveInput(context, {
|
|
50
|
+
file: (0, __stryke_path_replace.replacePath)(filePath, context.config.root),
|
|
51
|
+
name: typeDefinition.name
|
|
52
|
+
}, entry.input, entry.output);
|
|
53
|
+
return (await context.fs.glob((0, __stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot))).map((file) => resolveInput(context, {
|
|
54
|
+
file: (0, __stryke_path_replace.replacePath)(file, context.config.root),
|
|
55
|
+
name: typeDefinition.name
|
|
56
|
+
}, entry.input, entry.output));
|
|
57
|
+
}).flat().filter(Boolean))).flat();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Checks if the provided entry is a type definition.
|
|
61
|
+
*
|
|
62
|
+
* @param entry - The entry to check.
|
|
63
|
+
* @returns True if the entry is a type definition, false otherwise.
|
|
64
|
+
*/
|
|
65
|
+
function isTypeDefinition(entry) {
|
|
66
|
+
return !(0, __stryke_type_checks_is_string.isString)(entry) && entry.file !== void 0;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Checks if the provided entry is a resolved entry type definition.
|
|
70
|
+
*
|
|
71
|
+
* @param entry - The entry to check.
|
|
72
|
+
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
73
|
+
*/
|
|
74
|
+
function isResolvedEntryTypeDefinition(entry) {
|
|
75
|
+
return !(0, __stryke_type_checks_is_regexp.isRegExp)(entry) && isTypeDefinition(entry) && entry.output !== void 0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
79
|
+
*
|
|
80
|
+
* @param context - The current context
|
|
81
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
82
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
83
|
+
*/
|
|
84
|
+
function resolveInputsSync(context, typeDefinitions) {
|
|
85
|
+
return ((0, __stryke_type_checks_is_object.isObject)(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, __stryke_convert_to_array.toArray)(typeDefinitions)).map((entry) => {
|
|
86
|
+
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
87
|
+
...entry,
|
|
88
|
+
output: entry.output ? require_plugin_utils_paths.replacePathTokens(context, entry.output) : void 0,
|
|
89
|
+
file: require_plugin_utils_paths.replacePathTokens(context, entry.file)
|
|
90
|
+
};
|
|
91
|
+
let typeDefinition;
|
|
92
|
+
if ((0, __stryke_type_checks_is_string.isString)(entry)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(require_plugin_utils_paths.replacePathTokens(context, entry));
|
|
93
|
+
else if ((0, __stryke_type_checks_is_regexp.isRegExp)(entry)) typeDefinition = { file: require_plugin_utils_paths.replacePathTokens(context, entry.source) };
|
|
94
|
+
else {
|
|
95
|
+
typeDefinition = entry;
|
|
96
|
+
typeDefinition.file = require_plugin_utils_paths.replacePathTokens(context, typeDefinition.file);
|
|
97
|
+
}
|
|
98
|
+
const filePath = (0, __stryke_path_is_type.isAbsolutePath)(typeDefinition.file) ? typeDefinition.file : (0, __stryke_path_append.appendPath)(typeDefinition.file, context.config.root);
|
|
99
|
+
if (context.fs.isFileSync(filePath)) return resolveInput(context, {
|
|
100
|
+
file: (0, __stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot),
|
|
101
|
+
name: typeDefinition.name
|
|
102
|
+
});
|
|
103
|
+
return context.fs.globSync((0, __stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot)).map((file) => resolveInput(context, {
|
|
104
|
+
file,
|
|
105
|
+
name: typeDefinition.name
|
|
106
|
+
}));
|
|
107
|
+
}).flat().filter(Boolean);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get unique inputs from the provided list.
|
|
111
|
+
*
|
|
112
|
+
* @param inputs - The entry points to process.
|
|
113
|
+
* @returns An array of unique inputs (by file path or content hash).
|
|
114
|
+
*/
|
|
115
|
+
function getUniqueInputs(inputs = []) {
|
|
116
|
+
return (0, __stryke_type_checks_is_object.isObject)(inputs) ? inputs : (0, __stryke_helpers_get_unique.getUniqueBy)((0, __stryke_convert_to_array.toArray)(inputs), (item) => (0, __stryke_type_checks_is_set_string.isSetString)(item) ? item : (0, __stryke_hash_murmurhash.murmurhash)(item ?? {}, { maxLength: 24 }));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
exports.getUniqueInputs = getUniqueInputs;
|
|
121
|
+
exports.isResolvedEntryTypeDefinition = isResolvedEntryTypeDefinition;
|
|
122
|
+
exports.isTypeDefinition = isTypeDefinition;
|
|
123
|
+
exports.resolveEntryOutput = resolveEntryOutput;
|
|
124
|
+
exports.resolveInput = resolveInput;
|
|
125
|
+
exports.resolveInputs = resolveInputs;
|
|
126
|
+
exports.resolveInputsSync = resolveInputsSync;
|
|
127
|
+
//# sourceMappingURL=entry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.cjs","names":["replacePathTokens","typeDefinition: TypeDefinition"],"sources":["../../src/lib/entry.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport { BaseConfig } from \"../types\";\nimport { ResolvedEntryTypeDefinition } from \"../types/config\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\"\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n )\n ),\n joinPaths(context.config.root, \"src\")\n ),\n context.config.root\n ),\n \"src\"\n )\n );\n}\n\nexport function resolveInput(\n context: Context,\n typeDefinition: TypeDefinition,\n input?: string | RegExp | TypeDefinition | undefined,\n output?: string\n): ResolvedEntryTypeDefinition {\n return {\n ...typeDefinition,\n input:\n isSetString(input) || isRegExp(input)\n ? { file: String(input) }\n : typeDefinition,\n output: output || resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveInputs(\n context: Context,\n typeDefinitions:\n | TypeDefinition\n | ResolvedEntryTypeDefinition\n | string\n | RegExp\n | (string | RegExp | TypeDefinition | ResolvedEntryTypeDefinition)[]\n | Record<\n string,\n string | RegExp | TypeDefinition | (string | RegExp | TypeDefinition)[]\n >\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n (isObject(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else if (isRegExp(entry)) {\n typeDefinition = { file: replacePathTokens(context, entry.source) };\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(\n context,\n typeDefinition.file\n );\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (await context.fs.isFile(filePath)) {\n return resolveInput(\n context,\n {\n file: replacePath(filePath, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n );\n }\n\n return (\n await context.fs.glob(\n appendPath(filePath, context.workspaceConfig.workspaceRoot)\n )\n ).map(file =>\n resolveInput(\n context,\n {\n file: replacePath(file, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n )\n );\n })\n .flat()\n .filter(Boolean)\n )\n ).flat();\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(\n entry: TypeDefinitionParameter\n): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition | RegExp\n): entry is ResolvedEntryTypeDefinition {\n return (\n !isRegExp(entry) &&\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveInputsSync(\n context: Context,\n typeDefinitions:\n | TypeDefinition\n | ResolvedEntryTypeDefinition\n | string\n | RegExp\n | (string | RegExp | TypeDefinition | ResolvedEntryTypeDefinition)[]\n | Record<\n string,\n string | RegExp | TypeDefinition | (string | RegExp | TypeDefinition)[]\n >\n): ResolvedEntryTypeDefinition[] {\n return (\n isObject(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else if (isRegExp(entry)) {\n typeDefinition = { file: replacePathTokens(context, entry.source) };\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (context.fs.isFileSync(filePath)) {\n return resolveInput(context, {\n file: appendPath(filePath, context.workspaceConfig.workspaceRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs\n .globSync(appendPath(filePath, context.workspaceConfig.workspaceRoot))\n .map(file =>\n resolveInput(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Get unique inputs from the provided list.\n *\n * @param inputs - The entry points to process.\n * @returns An array of unique inputs (by file path or content hash).\n */\nexport function getUniqueInputs(\n inputs: BaseConfig[\"input\"] = []\n): BaseConfig[\"input\"] {\n return isObject(inputs)\n ? inputs\n : getUniqueBy(toArray(inputs), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,SAAgB,mBACd,SACA,gBACQ;AACR,uPAMY,eAAe,8CAEb,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,MACD,CACF,0CAEC,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,KAChB,CACF,0CACS,QAAQ,OAAO,MAAM,MAAM,CACtC,EACD,QAAQ,OAAO,KAChB,EACD,MACD,CACF;;AAGH,SAAgB,aACd,SACA,gBACA,OACA,QAC6B;AAC7B,QAAO;EACL,GAAG;EACH,2DACc,MAAM,iDAAa,MAAM,GACjC,EAAE,MAAM,OAAO,MAAM,EAAE,GACvB;EACN,QAAQ,UAAU,mBAAmB,SAAS,eAAe;EAC9D;;;;;;;;;AAUH,eAAsB,cACpB,SACA,iBAUwC;AACxC,SACE,MAAM,QAAQ,kDACF,gBAAgB,GACtB,OAAO,OAAO,gBAAgB,CAAC,MAAM,0CAC7B,gBAAgB,EAEzB,IAAI,OAAM,UAAS;AAClB,MAAI,8BAA8B,MAAM,CACtC,QAAO;GACL,GAAG;GACH,QAAQ,MAAM,SACVA,6CAAkB,SAAS,MAAM,OAAO,GACxC;GACJ,MAAMA,6CAAkB,SAAS,MAAM,KAAK;GAC7C;EAGH,IAAIC;AACJ,mDAAa,MAAM,CACjB,kFACED,6CAAkB,SAAS,MAAM,CAClC;wDACiB,MAAM,CACxB,kBAAiB,EAAE,MAAMA,6CAAkB,SAAS,MAAM,OAAO,EAAE;OAC9D;AACL,oBAAiB;AACjB,kBAAe,OAAOA,6CACpB,SACA,eAAe,KAChB;;EAGH,MAAM,qDAA0B,eAAe,KAAK,GAChD,eAAe,4CACJ,eAAe,MAAM,QAAQ,OAAO,KAAK;AACxD,MAAI,MAAM,QAAQ,GAAG,OAAO,SAAS,CACnC,QAAO,aACL,SACA;GACE,6CAAkB,UAAU,QAAQ,OAAO,KAAK;GAChD,MAAM,eAAe;GACtB,EACA,MAAsC,OACtC,MAAsC,OACxC;AAGH,UACE,MAAM,QAAQ,GAAG,0CACJ,UAAU,QAAQ,gBAAgB,cAAc,CAC5D,EACD,KAAI,SACJ,aACE,SACA;GACE,6CAAkB,MAAM,QAAQ,OAAO,KAAK;GAC5C,MAAM,eAAe;GACtB,EACA,MAAsC,OACtC,MAAsC,OACxC,CACF;GACD,CACD,MAAM,CACN,OAAO,QAAQ,CACnB,EACD,MAAM;;;;;;;;AASV,SAAgB,iBACd,OACyB;AACzB,QAAO,8CAAU,MAAM,IAAI,MAAM,SAAS;;;;;;;;AAS5C,SAAgB,8BACd,OACsC;AACtC,QACE,8CAAU,MAAM,IAChB,iBAAiB,MAAM,IACtB,MAAsC,WAAW;;;;;;;;;AAWtD,SAAgB,kBACd,SACA,iBAU+B;AAC/B,sDACW,gBAAgB,GACrB,OAAO,OAAO,gBAAgB,CAAC,MAAM,0CAC7B,gBAAgB,EAE3B,KAAI,UAAS;AACZ,MAAI,8BAA8B,MAAM,CACtC,QAAO;GACL,GAAG;GACH,QAAQ,MAAM,SACVA,6CAAkB,SAAS,MAAM,OAAO,GACxC;GACJ,MAAMA,6CAAkB,SAAS,MAAM,KAAK;GAC7C;EAGH,IAAIC;AACJ,mDAAa,MAAM,CACjB,kFACED,6CAAkB,SAAS,MAAM,CAClC;wDACiB,MAAM,CACxB,kBAAiB,EAAE,MAAMA,6CAAkB,SAAS,MAAM,OAAO,EAAE;OAC9D;AACL,oBAAiB;AACjB,kBAAe,OAAOA,6CAAkB,SAAS,eAAe,KAAK;;EAGvE,MAAM,qDAA0B,eAAe,KAAK,GAChD,eAAe,4CACJ,eAAe,MAAM,QAAQ,OAAO,KAAK;AACxD,MAAI,QAAQ,GAAG,WAAW,SAAS,CACjC,QAAO,aAAa,SAAS;GAC3B,2CAAiB,UAAU,QAAQ,gBAAgB,cAAc;GACjE,MAAM,eAAe;GACtB,CAAC;AAGJ,SAAO,QAAQ,GACZ,8CAAoB,UAAU,QAAQ,gBAAgB,cAAc,CAAC,CACrE,KAAI,SACH,aAAa,SAAS;GACpB;GACA,MAAM,eAAe;GACtB,CAAC,CACH;GACH,CACD,MAAM,CACN,OAAO,QAAQ;;;;;;;;AASpB,SAAgB,gBACd,SAA8B,EAAE,EACX;AACrB,qDAAgB,OAAO,GACnB,6FACoB,OAAO,GAAG,6DAChB,KAAK,GAAG,gDAAkB,QAAQ,EAAE,EAAE,EAAE,WAAW,IAAI,CAAC,CACrE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Context } from "../types/context.cjs";
|
|
2
|
+
import { BaseConfig, ResolvedEntryTypeDefinition } from "../types/config.cjs";
|
|
3
|
+
import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/entry.d.ts
|
|
6
|
+
declare function resolveEntryOutput(context: Context, typeDefinition: TypeDefinition): string;
|
|
7
|
+
declare function resolveInput(context: Context, typeDefinition: TypeDefinition, input?: string | RegExp | TypeDefinition | undefined, output?: string): ResolvedEntryTypeDefinition;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
10
|
+
*
|
|
11
|
+
* @param context - The current context
|
|
12
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
13
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveInputs(context: Context, typeDefinitions: TypeDefinition | ResolvedEntryTypeDefinition | string | RegExp | (string | RegExp | TypeDefinition | ResolvedEntryTypeDefinition)[] | Record<string, string | RegExp | TypeDefinition | (string | RegExp | TypeDefinition)[]>): Promise<ResolvedEntryTypeDefinition[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the provided entry is a type definition.
|
|
18
|
+
*
|
|
19
|
+
* @param entry - The entry to check.
|
|
20
|
+
* @returns True if the entry is a type definition, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
declare function isTypeDefinition(entry: TypeDefinitionParameter): entry is TypeDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if the provided entry is a resolved entry type definition.
|
|
25
|
+
*
|
|
26
|
+
* @param entry - The entry to check.
|
|
27
|
+
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
declare function isResolvedEntryTypeDefinition(entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition | RegExp): entry is ResolvedEntryTypeDefinition;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
32
|
+
*
|
|
33
|
+
* @param context - The current context
|
|
34
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
35
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveInputsSync(context: Context, typeDefinitions: TypeDefinition | ResolvedEntryTypeDefinition | string | RegExp | (string | RegExp | TypeDefinition | ResolvedEntryTypeDefinition)[] | Record<string, string | RegExp | TypeDefinition | (string | RegExp | TypeDefinition)[]>): ResolvedEntryTypeDefinition[];
|
|
38
|
+
/**
|
|
39
|
+
* Get unique inputs from the provided list.
|
|
40
|
+
*
|
|
41
|
+
* @param inputs - The entry points to process.
|
|
42
|
+
* @returns An array of unique inputs (by file path or content hash).
|
|
43
|
+
*/
|
|
44
|
+
declare function getUniqueInputs(inputs?: BaseConfig["input"]): BaseConfig["input"];
|
|
45
|
+
//#endregion
|
|
46
|
+
export { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync };
|
|
47
|
+
//# sourceMappingURL=entry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.cts","names":[],"sources":["../../src/lib/entry.ts"],"sourcesContent":[],"mappings":";;;;;iBAuCgB,kBAAA,UACL,yBACO;AAFF,iBA+BA,YAAA,CA/BkB,OACvB,EA+BA,OA9BO,EAAA,cAAc,EA+Bd,cA/Bc,EAAA,KAAA,CAAA,EAAA,MAAA,GAgCb,MAhCa,GAgCJ,cAhCI,GAAA,SAAA,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAkC7B,2BAlC6B;AA6BhC;;;;;;;AAuBsB,iBAAA,aAAA,CAAa,OAAA,EACxB,OADwB,EAAA,eAAA,EAG7B,cAH6B,GAI7B,2BAJ6B,GAAA,MAAA,GAM7B,MAN6B,GAAA,CAAA,MAAA,GAOnB,MAPmB,GAOV,cAPU,GAOO,2BAPP,CAAA,EAAA,GAQ7B,MAR6B,CAAA,MAAA,EAAA,MAAA,GAUlB,MAVkB,GAUT,cAVS,GAAA,CAAA,MAAA,GAUkB,MAVlB,GAU2B,cAV3B,CAAA,EAAA,CAAA,CAAA,EAYhC,OAZgC,CAYxB,2BAZwB,EAAA,CAAA;;;;;;;AAOO,iBAiF1B,gBAAA,CAjF0B,KAAA,EAkFjC,uBAlFiC,CAAA,EAAA,KAAA,IAmF9B,cAnF8B;;;;;;;AAKvC,iBAwFa,6BAAA,CAxFb,KAAA,EAyFM,uBAzFN,GAyFgC,2BAzFhC,GAyF8D,MAzF9D,CAAA,EAAA,KAAA,IA0FS,2BA1FT;;AA4EH;AAYA;;;;;AAEuC,iBAevB,iBAAA,CAfuB,OAAA,EAgB5B,OAhB4B,EAAA,eAAA,EAkBjC,cAlBiC,GAmBjC,2BAnBiC,GAAA,MAAA,GAqBjC,MArBiC,GAAA,CAAA,MAAA,GAsBvB,MAtBuB,GAsBd,cAtBc,GAsBG,2BAtBH,CAAA,EAAA,GAuBjC,MAvBiC,CAAA,MAAA,EAAA,MAAA,GAyBtB,MAzBsB,GAyBb,cAzBa,GAAA,CAAA,MAAA,GAyBc,MAzBd,GAyBuB,cAzBvB,CAAA,EAAA,CAAA,CAAA,EA2BpC,2BA3BoC,EAAA;AAevC;;;;;;AAOyB,iBA+DT,eAAA,CA/DS,MAAA,CAAA,EAgEf,UAhEe,CAAA,OAAA,CAAA,CAAA,EAiEtB,UAjEsB,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context } from "../types/context.mjs";
|
|
2
|
+
import { BaseConfig, ResolvedEntryTypeDefinition } from "../types/config.mjs";
|
|
3
|
+
import "../types/index.mjs";
|
|
4
|
+
import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/entry.d.ts
|
|
7
|
+
declare function resolveEntryOutput(context: Context, typeDefinition: TypeDefinition): string;
|
|
8
|
+
declare function resolveInput(context: Context, typeDefinition: TypeDefinition, input?: string | RegExp | TypeDefinition | undefined, output?: string): ResolvedEntryTypeDefinition;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
11
|
+
*
|
|
12
|
+
* @param context - The current context
|
|
13
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
14
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
15
|
+
*/
|
|
16
|
+
declare function resolveInputs(context: Context, typeDefinitions: TypeDefinition | ResolvedEntryTypeDefinition | string | RegExp | (string | RegExp | TypeDefinition | ResolvedEntryTypeDefinition)[] | Record<string, string | RegExp | TypeDefinition | (string | RegExp | TypeDefinition)[]>): Promise<ResolvedEntryTypeDefinition[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the provided entry is a type definition.
|
|
19
|
+
*
|
|
20
|
+
* @param entry - The entry to check.
|
|
21
|
+
* @returns True if the entry is a type definition, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
declare function isTypeDefinition(entry: TypeDefinitionParameter): entry is TypeDefinition;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the provided entry is a resolved entry type definition.
|
|
26
|
+
*
|
|
27
|
+
* @param entry - The entry to check.
|
|
28
|
+
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
declare function isResolvedEntryTypeDefinition(entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition | RegExp): entry is ResolvedEntryTypeDefinition;
|
|
31
|
+
/**
|
|
32
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
33
|
+
*
|
|
34
|
+
* @param context - The current context
|
|
35
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
36
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
37
|
+
*/
|
|
38
|
+
declare function resolveInputsSync(context: Context, typeDefinitions: TypeDefinition | ResolvedEntryTypeDefinition | string | RegExp | (string | RegExp | TypeDefinition | ResolvedEntryTypeDefinition)[] | Record<string, string | RegExp | TypeDefinition | (string | RegExp | TypeDefinition)[]>): ResolvedEntryTypeDefinition[];
|
|
39
|
+
/**
|
|
40
|
+
* Get unique inputs from the provided list.
|
|
41
|
+
*
|
|
42
|
+
* @param inputs - The entry points to process.
|
|
43
|
+
* @returns An array of unique inputs (by file path or content hash).
|
|
44
|
+
*/
|
|
45
|
+
declare function getUniqueInputs(inputs?: BaseConfig["input"]): BaseConfig["input"];
|
|
46
|
+
//#endregion
|
|
47
|
+
export { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync };
|
|
48
|
+
//# sourceMappingURL=entry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.mts","names":[],"sources":["../../src/lib/entry.ts"],"sourcesContent":[],"mappings":";;;;;;iBAuCgB,kBAAA,UACL,yBACO;iBA6BF,YAAA,UACL,yBACO,iCACC,SAAS,8CAEzB;AApCH;AA+BA;;;;;;AAK8B,iBAkBR,aAAA,CAlBQ,OAAA,EAmBnB,OAnBmB,EAAA,eAAA,EAqBxB,cArBwB,GAsBxB,2BAtBwB,GAAA,MAAA,GAwBxB,MAxBwB,GAAA,CAAA,MAAA,GAyBd,MAzBc,GAyBL,cAzBK,GAyBY,2BAzBZ,CAAA,EAAA,GA0BxB,MA1BwB,CAAA,MAAA,EAAA,MAAA,GA4Bb,MA5Ba,GA4BJ,cA5BI,GAAA,CAAA,MAAA,GA4BuB,MA5BvB,GA4BgC,cA5BhC,CAAA,EAAA,CAAA,CAAA,EA8B3B,OA9B2B,CA8BnB,2BA9BmB,EAAA,CAAA;AAkB9B;;;;;;AAOyB,iBAiFT,gBAAA,CAjFS,KAAA,EAkFhB,uBAlFgB,CAAA,EAAA,KAAA,IAmFb,cAnFa;;;;;;;AAKd,iBAwFK,6BAAA,CAxFL,KAAA,EAyFF,uBAzFE,GAyFwB,2BAzFxB,GAyFsD,MAzFtD,CAAA,EAAA,KAAA,IA0FC,2BA1FD;;;AA4EX;AAYA;;;;AAEY,iBAeI,iBAAA,CAfJ,OAAA,EAgBD,OAhBC,EAAA,eAAA,EAkBN,cAlBM,GAmBN,2BAnBM,GAAA,MAAA,GAqBN,MArBM,GAAA,CAAA,MAAA,GAsBI,MAtBJ,GAsBa,cAtBb,GAsB8B,2BAtB9B,CAAA,EAAA,GAuBN,MAvBM,CAAA,MAAA,EAAA,MAAA,GAyBK,MAzBL,GAyBc,cAzBd,GAAA,CAAA,MAAA,GAyByC,MAzBzC,GAyBkD,cAzBlD,CAAA,EAAA,CAAA,CAAA,EA2BT,2BA3BS,EAAA;;AAeZ;;;;;AAOgB,iBA+DA,eAAA,CA/DA,MAAA,CAAA,EAgEN,UAhEM,CAAA,OAAA,CAAA,CAAA,EAiEb,UAjEa,CAAA,OAAA,CAAA"}
|