@powerlines/core 0.0.11 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{types → constants}/commands.cjs +2 -3
- package/dist/constants/commands.d.cts +5 -0
- package/dist/constants/commands.d.cts.map +1 -0
- package/dist/constants/commands.d.mts +5 -0
- package/dist/constants/commands.d.mts.map +1 -0
- package/dist/{types → constants}/commands.mjs +1 -1
- package/dist/constants/commands.mjs.map +1 -0
- package/dist/{lib/constants → constants}/environments.cjs +2 -3
- package/dist/{lib/constants → constants}/environments.d.cts +1 -1
- package/dist/constants/environments.d.cts.map +1 -0
- package/dist/{lib/constants → constants}/environments.d.mts +1 -1
- package/dist/constants/environments.d.mts.map +1 -0
- package/dist/{lib/constants → constants}/environments.mjs +1 -1
- package/dist/constants/environments.mjs.map +1 -0
- package/dist/{types → constants}/fs.cjs +2 -3
- package/dist/constants/fs.d.cts +7 -0
- package/dist/constants/fs.d.cts.map +1 -0
- package/dist/constants/fs.d.mts +7 -0
- package/dist/constants/fs.d.mts.map +1 -0
- package/dist/{types → constants}/fs.mjs +1 -1
- package/dist/constants/fs.mjs.map +1 -0
- package/dist/{types → constants}/hooks.cjs +2 -3
- package/dist/constants/hooks.d.cts +5 -0
- package/dist/constants/hooks.d.cts.map +1 -0
- package/dist/constants/hooks.d.mts +5 -0
- package/dist/constants/hooks.d.mts.map +1 -0
- package/dist/{types → constants}/hooks.mjs +1 -1
- package/dist/constants/hooks.mjs.map +1 -0
- package/dist/constants/index.cjs +25 -0
- package/dist/constants/index.d.cts +7 -0
- package/dist/constants/index.d.mts +7 -0
- package/dist/constants/index.mjs +8 -0
- package/dist/{lib/constants → constants}/meta.cjs +2 -3
- package/dist/{lib/constants → constants}/meta.d.cts +1 -1
- package/dist/constants/meta.d.cts.map +1 -0
- package/dist/{lib/constants → constants}/meta.d.mts +1 -1
- package/dist/constants/meta.d.mts.map +1 -0
- package/dist/{lib/constants → constants}/meta.mjs +1 -1
- package/dist/constants/meta.mjs.map +1 -0
- package/dist/{types → constants}/plugin.cjs +23 -6
- package/dist/constants/plugin.d.cts +9 -0
- package/dist/constants/plugin.d.cts.map +1 -0
- package/dist/constants/plugin.d.mts +9 -0
- package/dist/constants/plugin.d.mts.map +1 -0
- package/dist/{types → constants}/plugin.mjs +19 -3
- package/dist/constants/plugin.mjs.map +1 -0
- package/dist/index.cjs +0 -26
- package/dist/index.d.cts +6 -8
- package/dist/index.d.mts +6 -8
- package/dist/index.mjs +1 -9
- package/dist/lib/config.cjs +1 -2
- package/dist/lib/entry.cjs +22 -26
- package/dist/lib/entry.d.cts +12 -12
- package/dist/lib/entry.d.cts.map +1 -1
- package/dist/lib/entry.d.mts +12 -12
- package/dist/lib/entry.d.mts.map +1 -1
- package/dist/lib/entry.mjs +21 -24
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/index.cjs +0 -10
- package/dist/lib/index.d.cts +1 -3
- package/dist/lib/index.d.mts +1 -3
- package/dist/lib/index.mjs +1 -3
- package/dist/lib/logger.cjs +1 -2
- package/dist/lib/unplugin/helpers.cjs +3 -4
- package/dist/lib/unplugin/helpers.d.cts.map +1 -1
- package/dist/lib/unplugin/helpers.d.mts.map +1 -1
- package/dist/lib/unplugin/helpers.mjs +1 -1
- package/dist/lib/unplugin/helpers.mjs.map +1 -1
- package/dist/lib/unplugin/module-resolution.cjs +1 -2
- package/dist/lib/unplugin/plugin.cjs +1 -2
- package/dist/lib/utilities/file-header.cjs +1 -2
- package/dist/lib/utilities/file-header.d.cts.map +1 -1
- package/dist/lib/utilities/file-header.d.mts.map +1 -1
- package/dist/lib/utilities/format.cjs +1 -2
- package/dist/lib/utilities/source-file.cjs +1 -2
- package/dist/lib/utilities/source-map.cjs +1 -2
- package/dist/lib/utilities/write-file.cjs +1 -2
- package/dist/plugin-base.cjs +1 -2
- package/dist/plugin-utils/build-helpers.cjs +2 -3
- package/dist/plugin-utils/build-helpers.mjs +1 -1
- package/dist/plugin-utils/context-helpers.cjs +1 -2
- package/dist/plugin-utils/extend.cjs +1 -2
- package/dist/plugin-utils/format-package-json.cjs +1 -2
- package/dist/plugin-utils/get-config-path.cjs +1 -2
- package/dist/plugin-utils/helpers.cjs +6 -8
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +1 -2
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +1 -2
- package/dist/plugin-utils/modules.cjs +1 -2
- package/dist/plugin-utils/paths.cjs +1 -2
- package/dist/types/commands.d.cts +2 -2
- package/dist/types/commands.d.cts.map +1 -1
- package/dist/types/commands.d.mts +2 -2
- package/dist/types/commands.d.mts.map +1 -1
- package/dist/types/config.d.cts +8 -8
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +8 -8
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +4 -4
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +4 -4
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.cts +5 -8
- package/dist/types/fs.d.cts.map +1 -1
- package/dist/types/fs.d.mts +5 -8
- package/dist/types/fs.d.mts.map +1 -1
- package/dist/types/hooks.d.cts +1 -2
- package/dist/types/hooks.d.cts.map +1 -1
- package/dist/types/hooks.d.mts +1 -2
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/index.d.mts +6 -7
- package/dist/types/plugin.d.cts +2 -4
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +2 -4
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/unplugin.d.cts +6 -8
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +6 -8
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +393 -103
- package/dist/lib/config.cjs.map +0 -1
- package/dist/lib/constants/environments.cjs.map +0 -1
- package/dist/lib/constants/environments.d.cts.map +0 -1
- package/dist/lib/constants/environments.d.mts.map +0 -1
- package/dist/lib/constants/environments.mjs.map +0 -1
- package/dist/lib/constants/index.cjs +0 -11
- package/dist/lib/constants/index.d.cts +0 -3
- package/dist/lib/constants/index.d.mts +0 -3
- package/dist/lib/constants/index.mjs +0 -4
- package/dist/lib/constants/meta.cjs.map +0 -1
- package/dist/lib/constants/meta.d.cts.map +0 -1
- package/dist/lib/constants/meta.d.mts.map +0 -1
- package/dist/lib/constants/meta.mjs.map +0 -1
- package/dist/lib/entry.cjs.map +0 -1
- package/dist/lib/logger.cjs.map +0 -1
- package/dist/lib/unplugin/helpers.cjs.map +0 -1
- package/dist/lib/unplugin/module-resolution.cjs.map +0 -1
- package/dist/lib/unplugin/plugin.cjs.map +0 -1
- package/dist/lib/utilities/file-header.cjs.map +0 -1
- package/dist/lib/utilities/format.cjs.map +0 -1
- package/dist/lib/utilities/source-file.cjs.map +0 -1
- package/dist/lib/utilities/source-map.cjs.map +0 -1
- package/dist/lib/utilities/write-file.cjs.map +0 -1
- package/dist/plugin-base.cjs.map +0 -1
- package/dist/plugin-utils/build-helpers.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/extend.cjs.map +0 -1
- package/dist/plugin-utils/format-package-json.cjs.map +0 -1
- package/dist/plugin-utils/get-config-path.cjs.map +0 -1
- package/dist/plugin-utils/helpers.cjs.map +0 -1
- package/dist/plugin-utils/merge.cjs.map +0 -1
- package/dist/plugin-utils/modules.cjs.map +0 -1
- package/dist/plugin-utils/paths.cjs.map +0 -1
- package/dist/types/api.cjs +0 -0
- package/dist/types/api.mjs +0 -1
- package/dist/types/commands.cjs.map +0 -1
- package/dist/types/commands.mjs.map +0 -1
- package/dist/types/config.cjs +0 -0
- package/dist/types/config.mjs +0 -1
- package/dist/types/context.cjs +0 -0
- package/dist/types/context.mjs +0 -1
- package/dist/types/fs.cjs.map +0 -1
- package/dist/types/fs.mjs.map +0 -1
- package/dist/types/hooks.cjs.map +0 -1
- package/dist/types/hooks.mjs.map +0 -1
- package/dist/types/index.cjs +0 -16
- package/dist/types/index.d.cts +0 -10
- package/dist/types/index.mjs +0 -7
- package/dist/types/plugin.cjs.map +0 -1
- package/dist/types/plugin.mjs.map +0 -1
- package/dist/types/tsconfig.cjs +0 -0
- package/dist/types/tsconfig.mjs +0 -1
- package/dist/types/unplugin.cjs +0 -24
- package/dist/types/unplugin.cjs.map +0 -1
- package/dist/types/unplugin.mjs +0 -22
- package/dist/types/unplugin.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./lib/config.mjs";
|
|
2
|
-
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./lib/constants/environments.mjs";
|
|
3
|
-
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./lib/constants/meta.mjs";
|
|
4
2
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.mjs";
|
|
5
3
|
import { createLog, extendLog } from "./lib/logger.mjs";
|
|
6
|
-
import { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from "./types/unplugin.mjs";
|
|
7
4
|
import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.mjs";
|
|
8
5
|
import { createUnpluginModuleResolutionFunctions } from "./lib/unplugin/module-resolution.mjs";
|
|
9
6
|
import { getMagicString, getSourceFile, getString } from "./lib/utilities/source-file.mjs";
|
|
@@ -13,10 +10,5 @@ import { format, formatFolder } from "./lib/utilities/format.mjs";
|
|
|
13
10
|
import { generateSourceMap } from "./lib/utilities/source-map.mjs";
|
|
14
11
|
import { writeFile } from "./lib/utilities/write-file.mjs";
|
|
15
12
|
import "./lib/index.mjs";
|
|
16
|
-
import { SUPPORTED_COMMANDS } from "./types/commands.mjs";
|
|
17
|
-
import { STORAGE_PRESETS, __VFS_PATCH__, __VFS_REVERT__ } from "./types/fs.mjs";
|
|
18
|
-
import { HOOKS_LIST_ORDERS } from "./types/hooks.mjs";
|
|
19
|
-
import { KNOWN_PLUGIN_FIELDS, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS } from "./types/plugin.mjs";
|
|
20
|
-
import "./types/index.mjs";
|
|
21
13
|
|
|
22
|
-
export {
|
|
14
|
+
export { combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/config.cjs
CHANGED
|
@@ -87,5 +87,4 @@ function defineConfig(config) {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
exports.defineConfig = defineConfig;
|
|
89
89
|
exports.loadUserConfigFile = loadUserConfigFile;
|
|
90
|
-
exports.loadWorkspaceConfig = loadWorkspaceConfig;
|
|
91
|
-
//# sourceMappingURL=config.cjs.map
|
|
90
|
+
exports.loadWorkspaceConfig = loadWorkspaceConfig;
|
package/dist/lib/entry.cjs
CHANGED
|
@@ -9,7 +9,6 @@ let __stryke_hash_murmurhash = require("@stryke/hash/murmurhash");
|
|
|
9
9
|
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
10
10
|
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
11
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
12
|
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
14
13
|
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
15
14
|
|
|
@@ -20,7 +19,7 @@ function resolveEntryOutput(context, typeDefinition) {
|
|
|
20
19
|
function resolveInput(context, typeDefinition, input, output) {
|
|
21
20
|
return {
|
|
22
21
|
...typeDefinition,
|
|
23
|
-
input: (0, __stryke_type_checks_is_set_string.isSetString)(input)
|
|
22
|
+
input: (0, __stryke_type_checks_is_set_string.isSetString)(input) ? { file: String(input) } : typeDefinition,
|
|
24
23
|
output: output || resolveEntryOutput(context, typeDefinition)
|
|
25
24
|
};
|
|
26
25
|
}
|
|
@@ -32,7 +31,7 @@ function resolveInput(context, typeDefinition, input, output) {
|
|
|
32
31
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
33
32
|
*/
|
|
34
33
|
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) => {
|
|
34
|
+
return (await Promise.all(((0, __stryke_type_checks_is_object.isObject)(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, __stryke_convert_to_array.toArray)(typeDefinitions)).map(async (entry) => {
|
|
36
35
|
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
37
36
|
...entry,
|
|
38
37
|
output: entry.output ? require_plugin_utils_paths.replacePathTokens(context, entry.output) : void 0,
|
|
@@ -40,7 +39,6 @@ async function resolveInputs(context, typeDefinitions) {
|
|
|
40
39
|
};
|
|
41
40
|
let typeDefinition;
|
|
42
41
|
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
42
|
else {
|
|
45
43
|
typeDefinition = entry;
|
|
46
44
|
typeDefinition.file = require_plugin_utils_paths.replacePathTokens(context, typeDefinition.file);
|
|
@@ -57,24 +55,6 @@ async function resolveInputs(context, typeDefinitions) {
|
|
|
57
55
|
}).flat().filter(Boolean))).flat();
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
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
58
|
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
79
59
|
*
|
|
80
60
|
* @param context - The current context
|
|
@@ -82,7 +62,7 @@ function isResolvedEntryTypeDefinition(entry) {
|
|
|
82
62
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
83
63
|
*/
|
|
84
64
|
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) => {
|
|
65
|
+
return ((0, __stryke_type_checks_is_object.isObject)(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, __stryke_convert_to_array.toArray)(typeDefinitions)).map((entry) => {
|
|
86
66
|
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
87
67
|
...entry,
|
|
88
68
|
output: entry.output ? require_plugin_utils_paths.replacePathTokens(context, entry.output) : void 0,
|
|
@@ -90,7 +70,6 @@ function resolveInputsSync(context, typeDefinitions) {
|
|
|
90
70
|
};
|
|
91
71
|
let typeDefinition;
|
|
92
72
|
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
73
|
else {
|
|
95
74
|
typeDefinition = entry;
|
|
96
75
|
typeDefinition.file = require_plugin_utils_paths.replacePathTokens(context, typeDefinition.file);
|
|
@@ -107,6 +86,24 @@ function resolveInputsSync(context, typeDefinitions) {
|
|
|
107
86
|
}).flat().filter(Boolean);
|
|
108
87
|
}
|
|
109
88
|
/**
|
|
89
|
+
* Checks if the provided entry is a type definition.
|
|
90
|
+
*
|
|
91
|
+
* @param entry - The entry to check.
|
|
92
|
+
* @returns True if the entry is a type definition, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
function isTypeDefinition(entry) {
|
|
95
|
+
return !(0, __stryke_type_checks_is_string.isString)(entry) && entry.file !== void 0;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Checks if the provided entry is a resolved entry type definition.
|
|
99
|
+
*
|
|
100
|
+
* @param entry - The entry to check.
|
|
101
|
+
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
102
|
+
*/
|
|
103
|
+
function isResolvedEntryTypeDefinition(entry) {
|
|
104
|
+
return isTypeDefinition(entry) && entry.output !== void 0;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
110
107
|
* Get unique inputs from the provided list.
|
|
111
108
|
*
|
|
112
109
|
* @param inputs - The entry points to process.
|
|
@@ -123,5 +120,4 @@ exports.isTypeDefinition = isTypeDefinition;
|
|
|
123
120
|
exports.resolveEntryOutput = resolveEntryOutput;
|
|
124
121
|
exports.resolveInput = resolveInput;
|
|
125
122
|
exports.resolveInputs = resolveInputs;
|
|
126
|
-
exports.resolveInputsSync = resolveInputsSync;
|
|
127
|
-
//# sourceMappingURL=entry.cjs.map
|
|
123
|
+
exports.resolveInputsSync = resolveInputsSync;
|
package/dist/lib/entry.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configura
|
|
|
4
4
|
|
|
5
5
|
//#region src/lib/entry.d.ts
|
|
6
6
|
declare function resolveEntryOutput(context: Context, typeDefinition: TypeDefinition): string;
|
|
7
|
-
declare function resolveInput(context: Context, typeDefinition: TypeDefinition, input?:
|
|
7
|
+
declare function resolveInput(context: Context, typeDefinition: TypeDefinition, input?: TypeDefinitionParameter, output?: string): ResolvedEntryTypeDefinition;
|
|
8
8
|
/**
|
|
9
9
|
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
10
10
|
*
|
|
@@ -12,29 +12,29 @@ declare function resolveInput(context: Context, typeDefinition: TypeDefinition,
|
|
|
12
12
|
* @param typeDefinitions - The type definitions to resolve.
|
|
13
13
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
14
14
|
*/
|
|
15
|
-
declare function resolveInputs(context: Context, typeDefinitions:
|
|
15
|
+
declare function resolveInputs(context: Context, typeDefinitions: TypeDefinitionParameter | TypeDefinitionParameter[] | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>): Promise<ResolvedEntryTypeDefinition[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
18
|
+
*
|
|
19
|
+
* @param context - The current context
|
|
20
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
21
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
22
|
+
*/
|
|
23
|
+
declare function resolveInputsSync(context: Context, typeDefinitions: TypeDefinitionParameter | TypeDefinitionParameter[] | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>): ResolvedEntryTypeDefinition[];
|
|
16
24
|
/**
|
|
17
25
|
* Checks if the provided entry is a type definition.
|
|
18
26
|
*
|
|
19
27
|
* @param entry - The entry to check.
|
|
20
28
|
* @returns True if the entry is a type definition, false otherwise.
|
|
21
29
|
*/
|
|
22
|
-
declare function isTypeDefinition(entry:
|
|
30
|
+
declare function isTypeDefinition(entry: any): entry is TypeDefinition;
|
|
23
31
|
/**
|
|
24
32
|
* Checks if the provided entry is a resolved entry type definition.
|
|
25
33
|
*
|
|
26
34
|
* @param entry - The entry to check.
|
|
27
35
|
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
28
36
|
*/
|
|
29
|
-
declare function isResolvedEntryTypeDefinition(entry: TypeDefinitionParameter | 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[];
|
|
37
|
+
declare function isResolvedEntryTypeDefinition(entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition): entry is ResolvedEntryTypeDefinition;
|
|
38
38
|
/**
|
|
39
39
|
* Get unique inputs from the provided list.
|
|
40
40
|
*
|
package/dist/lib/entry.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.cts","names":[],"sources":["../../src/lib/entry.ts"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"entry.d.cts","names":[],"sources":["../../src/lib/entry.ts"],"sourcesContent":[],"mappings":";;;;;iBAsCgB,kBAAA,UACL,yBACO;AAFF,iBA+BA,YAAA,CA9BL,OAAA,EA+BA,OA9BO,EAAA,cAAc,EA+Bd,cA/Bc,EAAA,KAAA,CAAA,EAgCtB,uBAhCsB,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAkC7B,2BAlC6B;AA6BhC;;;;;;AAoBA;AACW,iBADW,aAAA,CACX,OAAA,EAAA,OAAA,EAAA,eAAA,EAEL,uBAFK,GAGL,uBAHK,EAAA,GAIL,MAJK,CAAA,MAAA,EAIU,uBAJV,GAIoC,uBAJpC,EAAA,CAAA,CAAA,EAKR,OALQ,CAKA,2BALA,EAAA,CAAA;;;;;;;;AAKD,iBA2EM,iBAAA,CA3EN,OAAA,EA4EC,OA5ED,EAAA,eAAA,EA8EJ,uBA9EI,GA+EJ,uBA/EI,EAAA,GAgFJ,MAhFI,CAAA,MAAA,EAgFW,uBAhFX,GAgFqC,uBAhFrC,EAAA,CAAA,CAAA,EAiFP,2BAjFO,EAAA;AA2EV;;;;;;AAKM,iBAyDU,gBAAA,CAzDV,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,IAyDiD,cAzDjD;;;AAyDN;AAUA;;;AAEY,iBAFI,6BAAA,CAEJ,KAAA,EADH,uBACG,GADuB,2BACvB,CAAA,EAAA,KAAA,IAAA,2BAAA;;AAaZ;;;;;iBAAgB,eAAA,UACN,sBACP"}
|
package/dist/lib/entry.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configura
|
|
|
5
5
|
|
|
6
6
|
//#region src/lib/entry.d.ts
|
|
7
7
|
declare function resolveEntryOutput(context: Context, typeDefinition: TypeDefinition): string;
|
|
8
|
-
declare function resolveInput(context: Context, typeDefinition: TypeDefinition, input?:
|
|
8
|
+
declare function resolveInput(context: Context, typeDefinition: TypeDefinition, input?: TypeDefinitionParameter, output?: string): ResolvedEntryTypeDefinition;
|
|
9
9
|
/**
|
|
10
10
|
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
11
11
|
*
|
|
@@ -13,29 +13,29 @@ declare function resolveInput(context: Context, typeDefinition: TypeDefinition,
|
|
|
13
13
|
* @param typeDefinitions - The type definitions to resolve.
|
|
14
14
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
15
15
|
*/
|
|
16
|
-
declare function resolveInputs(context: Context, typeDefinitions:
|
|
16
|
+
declare function resolveInputs(context: Context, typeDefinitions: TypeDefinitionParameter | TypeDefinitionParameter[] | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>): Promise<ResolvedEntryTypeDefinition[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
19
|
+
*
|
|
20
|
+
* @param context - The current context
|
|
21
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
22
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
23
|
+
*/
|
|
24
|
+
declare function resolveInputsSync(context: Context, typeDefinitions: TypeDefinitionParameter | TypeDefinitionParameter[] | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>): ResolvedEntryTypeDefinition[];
|
|
17
25
|
/**
|
|
18
26
|
* Checks if the provided entry is a type definition.
|
|
19
27
|
*
|
|
20
28
|
* @param entry - The entry to check.
|
|
21
29
|
* @returns True if the entry is a type definition, false otherwise.
|
|
22
30
|
*/
|
|
23
|
-
declare function isTypeDefinition(entry:
|
|
31
|
+
declare function isTypeDefinition(entry: any): entry is TypeDefinition;
|
|
24
32
|
/**
|
|
25
33
|
* Checks if the provided entry is a resolved entry type definition.
|
|
26
34
|
*
|
|
27
35
|
* @param entry - The entry to check.
|
|
28
36
|
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
29
37
|
*/
|
|
30
|
-
declare function isResolvedEntryTypeDefinition(entry: TypeDefinitionParameter | 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[];
|
|
38
|
+
declare function isResolvedEntryTypeDefinition(entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition): entry is ResolvedEntryTypeDefinition;
|
|
39
39
|
/**
|
|
40
40
|
* Get unique inputs from the provided list.
|
|
41
41
|
*
|
package/dist/lib/entry.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.mts","names":[],"sources":["../../src/lib/entry.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"entry.d.mts","names":[],"sources":["../../src/lib/entry.ts"],"sourcesContent":[],"mappings":";;;;;;iBAsCgB,kBAAA,UACL,yBACO;iBA6BF,YAAA,UACL,yBACO,wBACR,2CAEP;AApCH;AA+BA;;;;;;AAoBsB,iBAAA,aAAA,CAAa,OAAA,EACxB,OADwB,EAAA,eAAA,EAG7B,uBAH6B,GAI7B,uBAJ6B,EAAA,GAK7B,MAL6B,CAAA,MAAA,EAKd,uBALc,GAKY,uBALZ,EAAA,CAAA,CAAA,EAMhC,OANgC,CAMxB,2BANwB,EAAA,CAAA;;;;;;;;AAMhC,iBA2Ea,iBAAA,CA3Eb,OAAA,EA4EQ,OA5ER,EAAA,eAAA,EA8EG,uBA9EH,GA+EG,uBA/EH,EAAA,GAgFG,MAhFH,CAAA,MAAA,EAgFkB,uBAhFlB,GAgF4C,uBAhF5C,EAAA,CAAA,CAAA,EAiFA,2BAjFA,EAAA;;AA2EH;;;;;AAK+C,iBAyD/B,gBAAA,CAzD+B,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,IAyDQ,cAzDR;;;;AAyD/C;AAUA;;AACmC,iBADnB,6BAAA,CACmB,KAAA,EAA1B,uBAA0B,GAAA,2BAAA,CAAA,EAAA,KAAA,IACvB,2BADuB;;;AAcnC;;;;iBAAgB,eAAA,UACN,sBACP"}
|
package/dist/lib/entry.mjs
CHANGED
|
@@ -8,7 +8,6 @@ import { murmurhash } from "@stryke/hash/murmurhash";
|
|
|
8
8
|
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
9
9
|
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
10
10
|
import { isObject } from "@stryke/type-checks/is-object";
|
|
11
|
-
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
12
11
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
13
12
|
import { isString } from "@stryke/type-checks/is-string";
|
|
14
13
|
|
|
@@ -19,7 +18,7 @@ function resolveEntryOutput(context, typeDefinition) {
|
|
|
19
18
|
function resolveInput(context, typeDefinition, input, output) {
|
|
20
19
|
return {
|
|
21
20
|
...typeDefinition,
|
|
22
|
-
input: isSetString(input)
|
|
21
|
+
input: isSetString(input) ? { file: String(input) } : typeDefinition,
|
|
23
22
|
output: output || resolveEntryOutput(context, typeDefinition)
|
|
24
23
|
};
|
|
25
24
|
}
|
|
@@ -31,7 +30,7 @@ function resolveInput(context, typeDefinition, input, output) {
|
|
|
31
30
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
32
31
|
*/
|
|
33
32
|
async function resolveInputs(context, typeDefinitions) {
|
|
34
|
-
return (await Promise.all((isObject(typeDefinitions) ? Object.values(typeDefinitions).flat() : toArray(typeDefinitions)).map(async (entry) => {
|
|
33
|
+
return (await Promise.all((isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : toArray(typeDefinitions)).map(async (entry) => {
|
|
35
34
|
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
36
35
|
...entry,
|
|
37
36
|
output: entry.output ? replacePathTokens(context, entry.output) : void 0,
|
|
@@ -39,7 +38,6 @@ async function resolveInputs(context, typeDefinitions) {
|
|
|
39
38
|
};
|
|
40
39
|
let typeDefinition;
|
|
41
40
|
if (isString(entry)) typeDefinition = parseTypeDefinition(replacePathTokens(context, entry));
|
|
42
|
-
else if (isRegExp(entry)) typeDefinition = { file: replacePathTokens(context, entry.source) };
|
|
43
41
|
else {
|
|
44
42
|
typeDefinition = entry;
|
|
45
43
|
typeDefinition.file = replacePathTokens(context, typeDefinition.file);
|
|
@@ -56,24 +54,6 @@ async function resolveInputs(context, typeDefinitions) {
|
|
|
56
54
|
}).flat().filter(Boolean))).flat();
|
|
57
55
|
}
|
|
58
56
|
/**
|
|
59
|
-
* Checks if the provided entry is a type definition.
|
|
60
|
-
*
|
|
61
|
-
* @param entry - The entry to check.
|
|
62
|
-
* @returns True if the entry is a type definition, false otherwise.
|
|
63
|
-
*/
|
|
64
|
-
function isTypeDefinition(entry) {
|
|
65
|
-
return !isString(entry) && entry.file !== void 0;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Checks if the provided entry is a resolved entry type definition.
|
|
69
|
-
*
|
|
70
|
-
* @param entry - The entry to check.
|
|
71
|
-
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
72
|
-
*/
|
|
73
|
-
function isResolvedEntryTypeDefinition(entry) {
|
|
74
|
-
return !isRegExp(entry) && isTypeDefinition(entry) && entry.output !== void 0;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
57
|
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
78
58
|
*
|
|
79
59
|
* @param context - The current context
|
|
@@ -81,7 +61,7 @@ function isResolvedEntryTypeDefinition(entry) {
|
|
|
81
61
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
82
62
|
*/
|
|
83
63
|
function resolveInputsSync(context, typeDefinitions) {
|
|
84
|
-
return (isObject(typeDefinitions) ? Object.values(typeDefinitions).flat() : toArray(typeDefinitions)).map((entry) => {
|
|
64
|
+
return (isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : toArray(typeDefinitions)).map((entry) => {
|
|
85
65
|
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
86
66
|
...entry,
|
|
87
67
|
output: entry.output ? replacePathTokens(context, entry.output) : void 0,
|
|
@@ -89,7 +69,6 @@ function resolveInputsSync(context, typeDefinitions) {
|
|
|
89
69
|
};
|
|
90
70
|
let typeDefinition;
|
|
91
71
|
if (isString(entry)) typeDefinition = parseTypeDefinition(replacePathTokens(context, entry));
|
|
92
|
-
else if (isRegExp(entry)) typeDefinition = { file: replacePathTokens(context, entry.source) };
|
|
93
72
|
else {
|
|
94
73
|
typeDefinition = entry;
|
|
95
74
|
typeDefinition.file = replacePathTokens(context, typeDefinition.file);
|
|
@@ -106,6 +85,24 @@ function resolveInputsSync(context, typeDefinitions) {
|
|
|
106
85
|
}).flat().filter(Boolean);
|
|
107
86
|
}
|
|
108
87
|
/**
|
|
88
|
+
* Checks if the provided entry is a type definition.
|
|
89
|
+
*
|
|
90
|
+
* @param entry - The entry to check.
|
|
91
|
+
* @returns True if the entry is a type definition, false otherwise.
|
|
92
|
+
*/
|
|
93
|
+
function isTypeDefinition(entry) {
|
|
94
|
+
return !isString(entry) && entry.file !== void 0;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Checks if the provided entry is a resolved entry type definition.
|
|
98
|
+
*
|
|
99
|
+
* @param entry - The entry to check.
|
|
100
|
+
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
101
|
+
*/
|
|
102
|
+
function isResolvedEntryTypeDefinition(entry) {
|
|
103
|
+
return isTypeDefinition(entry) && entry.output !== void 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
109
106
|
* Get unique inputs from the provided list.
|
|
110
107
|
*
|
|
111
108
|
* @param inputs - The entry points to process.
|
package/dist/lib/entry.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.mjs","names":["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":"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"}
|
|
1
|
+
{"version":3,"file":"entry.mjs","names":["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 { 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?: TypeDefinitionParameter,\n output?: string\n): ResolvedEntryTypeDefinition {\n return {\n ...typeDefinition,\n input: isSetString(input) ? { file: String(input) } : 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 | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n (isObject(typeDefinitions) && !isTypeDefinition(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 {\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 * 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 | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): ResolvedEntryTypeDefinition[] {\n return (\n isObject(typeDefinitions) && !isTypeDefinition(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 {\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 * 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(entry: any): 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\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\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":"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"}
|
package/dist/lib/index.cjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const require_lib_config = require('./config.cjs');
|
|
2
|
-
const require_lib_constants_environments = require('./constants/environments.cjs');
|
|
3
|
-
const require_lib_constants_meta = require('./constants/meta.cjs');
|
|
4
2
|
const require_lib_entry = require('./entry.cjs');
|
|
5
3
|
const require_lib_logger = require('./logger.cjs');
|
|
6
4
|
const require_lib_unplugin_helpers = require('./unplugin/helpers.cjs');
|
|
@@ -14,14 +12,6 @@ const require_lib_utilities_source_map = require('./utilities/source-map.cjs');
|
|
|
14
12
|
const require_lib_utilities_write_file = require('./utilities/write-file.cjs');
|
|
15
13
|
require('./utilities/index.cjs');
|
|
16
14
|
|
|
17
|
-
exports.CACHE_HASH_LENGTH = require_lib_constants_meta.CACHE_HASH_LENGTH;
|
|
18
|
-
exports.CLIENT_ENVIRONMENT = require_lib_constants_environments.CLIENT_ENVIRONMENT;
|
|
19
|
-
exports.DEFAULT_ENVIRONMENT = require_lib_constants_environments.DEFAULT_ENVIRONMENT;
|
|
20
|
-
exports.GLOBAL_ENVIRONMENT = require_lib_constants_environments.GLOBAL_ENVIRONMENT;
|
|
21
|
-
exports.ROOT_HASH_LENGTH = require_lib_constants_meta.ROOT_HASH_LENGTH;
|
|
22
|
-
exports.RSC_ENVIRONMENT = require_lib_constants_environments.RSC_ENVIRONMENT;
|
|
23
|
-
exports.SERVER_ENVIRONMENT = require_lib_constants_environments.SERVER_ENVIRONMENT;
|
|
24
|
-
exports.SSR_ENVIRONMENT = require_lib_constants_environments.SSR_ENVIRONMENT;
|
|
25
15
|
exports.combineContexts = require_lib_unplugin_helpers.combineContexts;
|
|
26
16
|
exports.createLog = require_lib_logger.createLog;
|
|
27
17
|
exports.createUnplugin = require_lib_unplugin_plugin.createUnplugin;
|
package/dist/lib/index.d.cts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./config.cjs";
|
|
2
|
-
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./constants/environments.cjs";
|
|
3
|
-
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./constants/meta.cjs";
|
|
4
2
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./entry.cjs";
|
|
5
3
|
import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./logger.cjs";
|
|
6
4
|
import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.cjs";
|
|
@@ -11,4 +9,4 @@ import { format, formatFolder } from "./utilities/format.cjs";
|
|
|
11
9
|
import { getMagicString, getSourceFile, getString } from "./utilities/source-file.cjs";
|
|
12
10
|
import { generateSourceMap } from "./utilities/source-map.cjs";
|
|
13
11
|
import { writeFile } from "./utilities/write-file.cjs";
|
|
14
|
-
export {
|
|
12
|
+
export { CreateLogOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/index.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./config.mjs";
|
|
2
|
-
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./constants/environments.mjs";
|
|
3
|
-
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./constants/meta.mjs";
|
|
4
2
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./entry.mjs";
|
|
5
3
|
import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./logger.mjs";
|
|
6
4
|
import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.mjs";
|
|
@@ -13,4 +11,4 @@ import { getMagicString, getSourceFile, getString } from "./utilities/source-fil
|
|
|
13
11
|
import { generateSourceMap } from "./utilities/source-map.mjs";
|
|
14
12
|
import { writeFile } from "./utilities/write-file.mjs";
|
|
15
13
|
import "./utilities/index.mjs";
|
|
16
|
-
export {
|
|
14
|
+
export { CreateLogOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./config.mjs";
|
|
2
|
-
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./constants/environments.mjs";
|
|
3
|
-
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./constants/meta.mjs";
|
|
4
2
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./entry.mjs";
|
|
5
3
|
import { createLog, extendLog } from "./logger.mjs";
|
|
6
4
|
import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.mjs";
|
|
@@ -14,4 +12,4 @@ import { generateSourceMap } from "./utilities/source-map.mjs";
|
|
|
14
12
|
import { writeFile } from "./utilities/write-file.mjs";
|
|
15
13
|
import "./utilities/index.mjs";
|
|
16
14
|
|
|
17
|
-
export {
|
|
15
|
+
export { combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/logger.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_plugin = require('../../constants/plugin.cjs');
|
|
3
3
|
let defu = require("defu");
|
|
4
4
|
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
5
|
|
|
@@ -21,10 +21,9 @@ function combineContexts(contextA, contextB) {
|
|
|
21
21
|
* @returns True if the value is a UnpluginBuilderVariant, false otherwise.
|
|
22
22
|
*/
|
|
23
23
|
function isUnpluginBuilderVariant(str) {
|
|
24
|
-
return (0, __stryke_type_checks_is_set_string.isSetString)(str) &&
|
|
24
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(str) && require_plugin.UNPLUGIN_BUILDER_VARIANTS.includes(str);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
28
|
exports.combineContexts = combineContexts;
|
|
29
|
-
exports.isUnpluginBuilderVariant = isUnpluginBuilderVariant;
|
|
30
|
-
//# sourceMappingURL=helpers.cjs.map
|
|
29
|
+
exports.isUnpluginBuilderVariant = isUnpluginBuilderVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAgCA;;;;;AAGY,iBAHI,eAGJ,CAAA,kBAFQ,iBAER,GAF4B,oBAE5B,EAAA,kBADQ,iBACR,GAD4B,oBAC5B,CAAA,CAAA,QAAA,EAAA,SAAA,EAAA,QAAA,EAAqB,SAArB,CAAA,EAAiC,SAAjC,GAA6C,SAA7C;;;;;AAUZ;;iBAAgB,wBAAA,uBAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAgCA;;;;;AAGY,iBAHI,eAGJ,CAAA,kBAFQ,iBAER,GAF4B,oBAE5B,EAAA,kBADQ,iBACR,GAD4B,oBAC5B,CAAA,CAAA,QAAA,EAAA,SAAA,EAAA,QAAA,EAAqB,SAArB,CAAA,EAAiC,SAAjC,GAA6C,SAA7C;;;;;AAUZ;;iBAAgB,wBAAA,uBAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../src/lib/unplugin/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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport { UnpluginBuildContext } from \"unplugin\";\nimport { UnresolvedContext } from \"../../types/context\";\nimport {
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../src/lib/unplugin/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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { UnpluginBuildContext } from \"unplugin\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"../../constants/plugin\";\nimport type { UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginBuilderVariant } from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgB,gBAGd,UAAqB,UAA4C;AACjE,QAAO,KAAK,UAAU,SAAS;;;;;;;;AASjC,SAAgB,yBACd,KAC+B;AAC/B,QACE,YAAY,IAAI,IAChB,0BAA0B,SAAS,IAA8B"}
|
|
@@ -63,5 +63,4 @@ function createUnpluginModuleResolutionFunctions(context) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
//#endregion
|
|
66
|
-
exports.createUnpluginModuleResolutionFunctions = createUnpluginModuleResolutionFunctions;
|
|
67
|
-
//# sourceMappingURL=module-resolution.cjs.map
|
|
66
|
+
exports.createUnpluginModuleResolutionFunctions = createUnpluginModuleResolutionFunctions;
|
|
@@ -101,5 +101,4 @@ function createUnplugin(context, name = "unplugin") {
|
|
|
101
101
|
|
|
102
102
|
//#endregion
|
|
103
103
|
exports.createUnplugin = createUnplugin;
|
|
104
|
-
exports.createUnpluginResolver = createUnpluginResolver;
|
|
105
|
-
//# sourceMappingURL=plugin.cjs.map
|
|
104
|
+
exports.createUnpluginResolver = createUnpluginResolver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-header.d.cts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,
|
|
1
|
+
{"version":3,"file":"file-header.d.cts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,CAAsB,EAAA,MAAA;iBAFjB,aAAA,UACL,mBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,
|
|
1
|
+
{"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,CAAsB,EAAA,MAAA;iBAFjB,aAAA,UACL,mBACA"}
|