powerlines 0.41.6 → 0.41.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/README.md +14 -16
- package/dist/{api-CY668wMZ.mjs → api-BYLuEyjx.mjs} +142 -333
- package/dist/api-BYLuEyjx.mjs.map +1 -0
- package/dist/{api-GPlMYw0d.cjs → api-Zx_hzL3g.cjs} +505 -722
- package/dist/astro.cjs +8 -18
- package/dist/astro.d.cts +1 -2
- package/dist/astro.d.cts.map +1 -1
- package/dist/astro.d.mts +1 -6
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +6 -16
- package/dist/astro.mjs.map +1 -1
- package/dist/{chunk-CbDLau6x.cjs → chunk-AIJqnxB6.cjs} +27 -1
- package/dist/chunk-CtajNgzt.mjs +36 -0
- package/dist/config.cjs +20 -4
- package/dist/config.d.cts +1 -2
- package/dist/config.d.mts +1 -3
- package/dist/config.mjs +11 -2
- package/dist/config.mjs.map +1 -0
- package/dist/constants.cjs +20 -20
- package/dist/constants.d.cts +1 -24
- package/dist/constants.d.mts +1 -24
- package/dist/constants.mjs +11 -3
- package/dist/constants.mjs.map +1 -0
- package/dist/context/index.cjs +4 -9
- package/dist/context/index.d.cts +56 -132
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +55 -135
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -9
- package/dist/esbuild.cjs +60 -17
- package/dist/esbuild.d.cts +5 -29
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts +5 -33
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs +44 -12
- package/dist/esbuild.mjs.map +1 -0
- package/dist/farm.cjs +6 -13
- package/dist/farm.d.cts +2 -3
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +2 -6
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +4 -11
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +7 -13
- package/dist/index.d.cts +263 -6
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +263 -7
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -9
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +7 -14
- package/dist/next.d.cts +0 -1
- package/dist/next.d.cts.map +1 -1
- package/dist/next.d.mts +0 -1
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +6 -13
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt.cjs +12 -22
- package/dist/nuxt.d.cts +2 -3
- package/dist/nuxt.d.cts.map +1 -1
- package/dist/nuxt.d.mts +2 -7
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +8 -18
- package/dist/nuxt.mjs.map +1 -1
- package/dist/plugin-utils.cjs +20 -28
- package/dist/plugin-utils.d.cts +1 -267
- package/dist/plugin-utils.d.mts +1 -272
- package/dist/plugin-utils.mjs +11 -4
- package/dist/plugin-utils.mjs.map +1 -0
- package/dist/rolldown.cjs +52 -18
- package/dist/rolldown.d.cts +5 -29
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts +5 -32
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +36 -13
- package/dist/rolldown.mjs.map +1 -0
- package/dist/rollup.cjs +20 -48
- package/dist/rollup.d.cts +5 -29
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts +5 -32
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +6 -44
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +20 -82
- package/dist/rspack.d.cts +4 -24
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +4 -27
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +5 -77
- package/dist/rspack.mjs.map +1 -1
- package/dist/storage/index.cjs +2 -3
- package/dist/storage/index.d.cts +7 -7
- package/dist/storage/index.d.cts.map +1 -1
- package/dist/storage/index.d.mts +7 -11
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +1 -3
- package/dist/{tsconfig-C8M8X6U0.cjs → tsconfig-BJrUrPC_.cjs} +13 -13
- package/dist/{tsconfig-B92heKit.mjs → tsconfig-D9GCB2I9.mjs} +5 -5
- package/dist/tsconfig-D9GCB2I9.mjs.map +1 -0
- package/dist/tsdown.cjs +38 -187
- package/dist/tsdown.d.cts +2 -24
- package/dist/tsdown.d.cts.map +1 -1
- package/dist/tsdown.d.mts +4 -30
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +8 -167
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +29 -134
- package/dist/tsup.d.cts +2 -24
- package/dist/tsup.d.cts.map +1 -1
- package/dist/tsup.d.mts +2 -28
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +7 -122
- package/dist/tsup.mjs.map +1 -1
- package/dist/types-DerAvFjs.d.cts +4 -0
- package/dist/types-DerAvFjs.d.cts.map +1 -0
- package/dist/types-ro7jWCtL.d.mts +4 -0
- package/dist/types-ro7jWCtL.d.mts.map +1 -0
- package/dist/typescript/index.cjs +2 -1
- package/dist/typescript/index.d.cts +2 -2
- package/dist/typescript/index.d.cts.map +1 -1
- package/dist/typescript/index.d.mts +1 -4
- package/dist/typescript/index.d.mts.map +1 -1
- package/dist/typescript/index.mjs +1 -1
- package/dist/unloader.cjs +6 -13
- package/dist/unloader.d.cts +2 -4
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +2 -7
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +4 -11
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin.cjs +11 -14
- package/dist/unplugin.d.cts +5 -6
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts +3 -6
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +6 -10
- package/dist/utils.cjs +38 -22
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.mts +3 -3
- package/dist/utils.mjs +19 -3
- package/dist/utils.mjs.map +1 -0
- package/dist/{virtual-B1MLgqnQ.cjs → virtual-Cbvj12lU.cjs} +33 -33
- package/dist/{virtual-B9imjOqe.mjs → virtual-DvkJm7gK.mjs} +7 -7
- package/dist/virtual-DvkJm7gK.mjs.map +1 -0
- package/dist/vite.cjs +84 -19
- package/dist/vite.d.cts +5 -16
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +5 -19
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +67 -14
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack.cjs +42 -16
- package/dist/webpack.d.cts +5 -29
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts +5 -32
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +26 -11
- package/dist/webpack.mjs.map +1 -0
- package/package.json +17 -17
- package/dist/api-CY668wMZ.mjs.map +0 -1
- package/dist/commands-7TWNqTU1.d.cts +0 -12
- package/dist/commands-7TWNqTU1.d.cts.map +0 -1
- package/dist/commands-yacLkOi0.d.mts +0 -12
- package/dist/commands-yacLkOi0.d.mts.map +0 -1
- package/dist/config-CK756s0L.d.mts +0 -2232
- package/dist/config-CK756s0L.d.mts.map +0 -1
- package/dist/config-CiPXgwzt.d.mts +0 -39
- package/dist/config-CiPXgwzt.d.mts.map +0 -1
- package/dist/config-D4Fh2gQL.mjs +0 -87
- package/dist/config-D4Fh2gQL.mjs.map +0 -1
- package/dist/config-D86Vw7SC.cjs +0 -105
- package/dist/config-J74ORCFY.d.cts +0 -39
- package/dist/config-J74ORCFY.d.cts.map +0 -1
- package/dist/config-vnrrSxEB.d.cts +0 -2232
- package/dist/config-vnrrSxEB.d.cts.map +0 -1
- package/dist/constants-CZh5rsgh.cjs +0 -103
- package/dist/constants-cXxSHhNp.mjs +0 -32
- package/dist/constants-cXxSHhNp.mjs.map +0 -1
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.mts.map +0 -1
- package/dist/esbuild-B3NuCco0.cjs +0 -100
- package/dist/esbuild-DWiE0pYc.mjs +0 -82
- package/dist/esbuild-DWiE0pYc.mjs.map +0 -1
- package/dist/index-2JXW-b2-.d.mts +0 -82
- package/dist/index-2JXW-b2-.d.mts.map +0 -1
- package/dist/index-6BLROVtJ.d.mts +0 -261
- package/dist/index-6BLROVtJ.d.mts.map +0 -1
- package/dist/index-C7W0kmm7.d.mts +0 -171
- package/dist/index-C7W0kmm7.d.mts.map +0 -1
- package/dist/index-DJ-k0GOX.d.cts +0 -261
- package/dist/index-DJ-k0GOX.d.cts.map +0 -1
- package/dist/paths-CS8ecCnW.mjs +0 -81
- package/dist/paths-CS8ecCnW.mjs.map +0 -1
- package/dist/paths-YmyIGEVo.cjs +0 -98
- package/dist/plugin-B9TQt-p0.d.cts +0 -82
- package/dist/plugin-B9TQt-p0.d.cts.map +0 -1
- package/dist/plugin-BE3wmhoU.d.cts +0 -26
- package/dist/plugin-BE3wmhoU.d.cts.map +0 -1
- package/dist/plugin-CZ_PJPpQ.cjs +0 -96
- package/dist/plugin-C_8RhG5V.d.mts +0 -26
- package/dist/plugin-C_8RhG5V.d.mts.map +0 -1
- package/dist/plugin-E5foRD0k.mjs +0 -61
- package/dist/plugin-E5foRD0k.mjs.map +0 -1
- package/dist/plugin-utils-C3HnZJl1.mjs +0 -387
- package/dist/plugin-utils-C3HnZJl1.mjs.map +0 -1
- package/dist/plugin-utils-Ck3cx3w6.cjs +0 -531
- package/dist/plugin-utils.d.cts.map +0 -1
- package/dist/plugin-utils.d.mts.map +0 -1
- package/dist/resolve-options-6sXFqzEA.mjs +0 -116
- package/dist/resolve-options-6sXFqzEA.mjs.map +0 -1
- package/dist/resolve-options-BQnTgg3V.cjs +0 -105
- package/dist/resolve-options-D-RGs8j8.mjs +0 -117
- package/dist/resolve-options-D-RGs8j8.mjs.map +0 -1
- package/dist/resolve-options-DHL3RM8F.mjs +0 -87
- package/dist/resolve-options-DHL3RM8F.mjs.map +0 -1
- package/dist/resolve-options-lxQ2pm0W.cjs +0 -127
- package/dist/resolve-options-vyFhhkLp.cjs +0 -133
- package/dist/rolldown-CQI8ps6f.cjs +0 -83
- package/dist/rolldown-DsXEFXyP.mjs +0 -65
- package/dist/rolldown-DsXEFXyP.mjs.map +0 -1
- package/dist/tsconfig-B92heKit.mjs.map +0 -1
- package/dist/types-Bh_vLuQ0.d.mts +0 -1
- package/dist/utils-BbDma_5Y.cjs +0 -449
- package/dist/utils-DoQcX7Sk.mjs +0 -339
- package/dist/utils-DoQcX7Sk.mjs.map +0 -1
- package/dist/virtual-B9imjOqe.mjs.map +0 -1
- package/dist/vite-Bx1gbbj3.mjs +0 -171
- package/dist/vite-Bx1gbbj3.mjs.map +0 -1
- package/dist/vite-XV170zx6.cjs +0 -189
- package/dist/webpack-9G4xJBfz.cjs +0 -107
- package/dist/webpack-BkTkELre.mjs +0 -88
- package/dist/webpack-BkTkELre.mjs.map +0 -1
- package/dist/write-file-CpNWY8SV.d.cts +0 -171
- package/dist/write-file-CpNWY8SV.d.cts.map +0 -1
package/dist/utils-BbDma_5Y.cjs
DELETED
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_paths = require('./paths-YmyIGEVo.cjs');
|
|
3
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
4
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
5
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
6
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
7
|
-
let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
8
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
9
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
10
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
11
|
-
let chalk = require("chalk");
|
|
12
|
-
chalk = require_chunk.__toESM(chalk);
|
|
13
|
-
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
14
|
-
let prettier = require("prettier");
|
|
15
|
-
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
16
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
17
|
-
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
18
|
-
let __stryke_hash = require("@stryke/hash");
|
|
19
|
-
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
20
|
-
let __stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
21
|
-
let __stryke_fs_write_file = require("@stryke/fs/write-file");
|
|
22
|
-
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
23
|
-
let __storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
24
|
-
let __storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
|
|
25
|
-
let __stryke_helpers_noop = require("@stryke/helpers/noop");
|
|
26
|
-
let magic_string = require("magic-string");
|
|
27
|
-
magic_string = require_chunk.__toESM(magic_string);
|
|
28
|
-
let diff_match_patch = require("diff-match-patch");
|
|
29
|
-
diff_match_patch = require_chunk.__toESM(diff_match_patch);
|
|
30
|
-
|
|
31
|
-
//#region ../core/src/lib/entry.ts
|
|
32
|
-
function resolveEntryOutput(context, typeDefinition) {
|
|
33
|
-
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"));
|
|
34
|
-
}
|
|
35
|
-
function resolveInput(context, typeDefinition, input, output) {
|
|
36
|
-
return {
|
|
37
|
-
...typeDefinition,
|
|
38
|
-
input: (0, __stryke_type_checks_is_set_string.isSetString)(input) ? { file: String(input) } : typeDefinition,
|
|
39
|
-
output: output || resolveEntryOutput(context, typeDefinition)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
44
|
-
*
|
|
45
|
-
* @param context - The current context
|
|
46
|
-
* @param typeDefinitions - The type definitions to resolve.
|
|
47
|
-
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
48
|
-
*/
|
|
49
|
-
async function resolveInputs(context, typeDefinitions) {
|
|
50
|
-
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) => {
|
|
51
|
-
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
52
|
-
...entry,
|
|
53
|
-
output: entry.output ? require_paths.replacePathTokens(context, entry.output) : void 0,
|
|
54
|
-
file: require_paths.replacePathTokens(context, entry.file)
|
|
55
|
-
};
|
|
56
|
-
let typeDefinition;
|
|
57
|
-
if ((0, __stryke_type_checks_is_string.isString)(entry)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(require_paths.replacePathTokens(context, entry));
|
|
58
|
-
else {
|
|
59
|
-
typeDefinition = entry;
|
|
60
|
-
typeDefinition.file = require_paths.replacePathTokens(context, typeDefinition.file);
|
|
61
|
-
}
|
|
62
|
-
const filePath = (0, __stryke_path_is_type.isAbsolutePath)(typeDefinition.file) ? typeDefinition.file : (0, __stryke_path_append.appendPath)(typeDefinition.file, context.config.root);
|
|
63
|
-
if (await context.fs.isFile(filePath)) return resolveInput(context, {
|
|
64
|
-
file: (0, __stryke_path_replace.replacePath)(filePath, context.config.root),
|
|
65
|
-
name: typeDefinition.name
|
|
66
|
-
}, entry.input, entry.output);
|
|
67
|
-
return (await context.fs.glob((0, __stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot))).map((file) => resolveInput(context, {
|
|
68
|
-
file: (0, __stryke_path_replace.replacePath)(file, context.config.root),
|
|
69
|
-
name: typeDefinition.name
|
|
70
|
-
}, entry.input, entry.output));
|
|
71
|
-
}).flat().filter(Boolean))).flat();
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
75
|
-
*
|
|
76
|
-
* @param context - The current context
|
|
77
|
-
* @param typeDefinitions - The type definitions to resolve.
|
|
78
|
-
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
79
|
-
*/
|
|
80
|
-
function resolveInputsSync(context, typeDefinitions) {
|
|
81
|
-
return ((0, __stryke_type_checks_is_object.isObject)(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, __stryke_convert_to_array.toArray)(typeDefinitions)).map((entry) => {
|
|
82
|
-
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
83
|
-
...entry,
|
|
84
|
-
output: entry.output ? require_paths.replacePathTokens(context, entry.output) : void 0,
|
|
85
|
-
file: require_paths.replacePathTokens(context, entry.file)
|
|
86
|
-
};
|
|
87
|
-
let typeDefinition;
|
|
88
|
-
if ((0, __stryke_type_checks_is_string.isString)(entry)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(require_paths.replacePathTokens(context, entry));
|
|
89
|
-
else {
|
|
90
|
-
typeDefinition = entry;
|
|
91
|
-
typeDefinition.file = require_paths.replacePathTokens(context, typeDefinition.file);
|
|
92
|
-
}
|
|
93
|
-
const filePath = (0, __stryke_path_is_type.isAbsolutePath)(typeDefinition.file) ? typeDefinition.file : (0, __stryke_path_append.appendPath)(typeDefinition.file, context.config.root);
|
|
94
|
-
if (context.fs.isFileSync(filePath)) return resolveInput(context, {
|
|
95
|
-
file: (0, __stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot),
|
|
96
|
-
name: typeDefinition.name
|
|
97
|
-
});
|
|
98
|
-
return context.fs.globSync((0, __stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot)).map((file) => resolveInput(context, {
|
|
99
|
-
file,
|
|
100
|
-
name: typeDefinition.name
|
|
101
|
-
}));
|
|
102
|
-
}).flat().filter(Boolean);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Checks if the provided entry is a type definition.
|
|
106
|
-
*
|
|
107
|
-
* @param entry - The entry to check.
|
|
108
|
-
* @returns True if the entry is a type definition, false otherwise.
|
|
109
|
-
*/
|
|
110
|
-
function isTypeDefinition(entry) {
|
|
111
|
-
return !(0, __stryke_type_checks_is_string.isString)(entry) && entry.file !== void 0;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Checks if the provided entry is a resolved entry type definition.
|
|
115
|
-
*
|
|
116
|
-
* @param entry - The entry to check.
|
|
117
|
-
* @returns True if the entry is a resolved entry type definition, false otherwise.
|
|
118
|
-
*/
|
|
119
|
-
function isResolvedEntryTypeDefinition(entry) {
|
|
120
|
-
return isTypeDefinition(entry) && entry.output !== void 0;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Get unique inputs from the provided list.
|
|
124
|
-
*
|
|
125
|
-
* @param inputs - The entry points to process.
|
|
126
|
-
* @returns An array of unique inputs (by file path or content hash).
|
|
127
|
-
*/
|
|
128
|
-
function getUniqueInputs(inputs = []) {
|
|
129
|
-
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)(item ?? {}, { maxLength: 24 }));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region ../core/src/lib/logger.ts
|
|
134
|
-
/**
|
|
135
|
-
* Create a logging function with a specific name and options.
|
|
136
|
-
*
|
|
137
|
-
* @param name - The name of the logging function.
|
|
138
|
-
* @param options - The options to configure the logging function.
|
|
139
|
-
* @returns A logging function.
|
|
140
|
-
*/
|
|
141
|
-
const createLog = (name, options = {}) => {
|
|
142
|
-
const logLevel = options.logLevel === null ? __storm_software_config_tools_types.LogLevelLabel.SILENT : options.logLevel || __storm_software_config_tools_types.LogLevelLabel.INFO;
|
|
143
|
-
if (logLevel === __storm_software_config_tools_types.LogLevelLabel.SILENT) return __stryke_helpers_noop.noop;
|
|
144
|
-
if (options.customLogger) return options.customLogger;
|
|
145
|
-
return (type, ...args) => (0, __storm_software_config_tools_logger.getLogFn)((0, __storm_software_config_tools_logger.getLogLevel)(type), {
|
|
146
|
-
...options,
|
|
147
|
-
logLevel
|
|
148
|
-
})(`${chalk.default.bold.hex((0, __storm_software_config_tools_utilities_colors.getColor)("brand", options))(`${name ? (0, __stryke_string_format_kebab_case.kebabCase)(name) : ""}${options.name ? `${name ? chalk.default.gray(" > ") : ""}${(0, __stryke_string_format_kebab_case.kebabCase)(options.name)}` : ""}${chalk.default.gray(" > ")}`)}${args.join(" ")} `.trim());
|
|
149
|
-
};
|
|
150
|
-
const BADGE_COLORS = [
|
|
151
|
-
"#00A0DD",
|
|
152
|
-
"#6FCE4E",
|
|
153
|
-
"#FBBF24",
|
|
154
|
-
"#F43F5E",
|
|
155
|
-
"#3B82F6",
|
|
156
|
-
"#A855F7",
|
|
157
|
-
"#469592",
|
|
158
|
-
"#288EDF",
|
|
159
|
-
"#D8B4FE",
|
|
160
|
-
"#10B981",
|
|
161
|
-
"#EF4444",
|
|
162
|
-
"#F0EC56",
|
|
163
|
-
"#F472B6",
|
|
164
|
-
"#22D3EE",
|
|
165
|
-
"#EAB308",
|
|
166
|
-
"#84CC16",
|
|
167
|
-
"#F87171",
|
|
168
|
-
"#0EA5E9",
|
|
169
|
-
"#D946EF",
|
|
170
|
-
"#FACC15",
|
|
171
|
-
"#34D399",
|
|
172
|
-
"#8B5CF6"
|
|
173
|
-
];
|
|
174
|
-
const extendLog = (logFn, name) => {
|
|
175
|
-
return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region ../core/src/lib/utilities/file-header.ts
|
|
180
|
-
/**
|
|
181
|
-
* Generates a file header comment with a warning about automatic overwriting.
|
|
182
|
-
*
|
|
183
|
-
* @param overwrite - Whether the file will be automatically overwritten. If `false`, the warning will indicate that the file will not be overwritten. If `true` or omitted, the warning will indicate that the file will be overwritten.
|
|
184
|
-
* @param framework - The name of the framework to include in the warning message. Defaults to "powerlines".
|
|
185
|
-
* @returns A string containing the file header warning message.
|
|
186
|
-
*/
|
|
187
|
-
function getFileHeaderWarningText(overwrite = true, framework = "powerlines") {
|
|
188
|
-
return overwrite !== false ? `Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \`output.overwrite\` option.` : `This file was generated on ${(/* @__PURE__ */ new Date()).toLocaleString()} - it will not be overwritten by ${(0, __stryke_string_format_title_case.titleCase)(framework)} while the \`output.overwrite\` option is set to \`true\`.`;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Generates a file header warning message based on the provided context.
|
|
192
|
-
*
|
|
193
|
-
* @param context - The Powerlines context.
|
|
194
|
-
* @returns A string containing the file header warning message.
|
|
195
|
-
*/
|
|
196
|
-
function getFileHeaderWarning(context) {
|
|
197
|
-
return getFileHeaderWarningText(context.config.output?.overwrite, context.config.framework);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Generates a file header comment for a generated source file, including a warning about automatic overwriting.
|
|
201
|
-
*
|
|
202
|
-
* @param context - The Powerlines context.
|
|
203
|
-
* @param comment - The comment syntax to use for the header (e.g., `//` for JavaScript/TypeScript, `#` for Python). Defaults to `//`.
|
|
204
|
-
* @returns A string containing the file header comment.
|
|
205
|
-
*/
|
|
206
|
-
function getFileHeader(context, comment = "//") {
|
|
207
|
-
return `
|
|
208
|
-
${comment} Generated by ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework) || "Powerlines"}
|
|
209
|
-
${comment} ${getFileHeaderWarning(context)}
|
|
210
|
-
`;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Generates a file header comment for a generated TypeScript source file, including a warning about automatic overwriting.
|
|
214
|
-
*
|
|
215
|
-
* @param context - The Powerlines context.
|
|
216
|
-
* @param options - Additional options for generating the file header, such as a directive to include and whether to add a Prettier ignore comment.
|
|
217
|
-
* @returns A string containing the file header comment for a TypeScript file.
|
|
218
|
-
*/
|
|
219
|
-
function getTypescriptFileHeader(context, options = {}) {
|
|
220
|
-
const { directive = null, prettierIgnore = false } = options;
|
|
221
|
-
return `/* eslint-disable */
|
|
222
|
-
// biome-ignore lint: disable
|
|
223
|
-
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
224
|
-
${getFileHeader(context)}
|
|
225
|
-
|
|
226
|
-
`;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region ../core/src/lib/utilities/source-file.ts
|
|
231
|
-
/**
|
|
232
|
-
* Get the string from the source.
|
|
233
|
-
*
|
|
234
|
-
* @param code - The source string or magic string.
|
|
235
|
-
* @returns The source string.
|
|
236
|
-
*/
|
|
237
|
-
function getString(code) {
|
|
238
|
-
if (!code) return "";
|
|
239
|
-
if ((0, __stryke_type_checks_is_string.isString)(code)) return code;
|
|
240
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(code) && "code" in code) return code.code;
|
|
241
|
-
return code.toString();
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Get the magic string.
|
|
245
|
-
*
|
|
246
|
-
* @param code - The source string or magic string.
|
|
247
|
-
* @returns The magic string.
|
|
248
|
-
*/
|
|
249
|
-
function getMagicString(code) {
|
|
250
|
-
if ((0, __stryke_type_checks_is_string.isString)(code)) return new magic_string.default(code);
|
|
251
|
-
return code;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Get the source file.
|
|
255
|
-
*
|
|
256
|
-
* @param code - The source code.
|
|
257
|
-
* @param id - The name of the file.
|
|
258
|
-
* @returns The source file.
|
|
259
|
-
*/
|
|
260
|
-
function getSourceFile(code, id) {
|
|
261
|
-
return {
|
|
262
|
-
id,
|
|
263
|
-
code: getMagicString(code ?? (0, __stryke_fs_read_file.readFileIfExistingSync)(id)),
|
|
264
|
-
env: []
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
//#endregion
|
|
269
|
-
//#region ../core/src/lib/utilities/source-map.ts
|
|
270
|
-
const dmp = new diff_match_patch.default();
|
|
271
|
-
/**
|
|
272
|
-
* Generate code with source map.
|
|
273
|
-
*
|
|
274
|
-
* @param code - The source code.
|
|
275
|
-
* @param id - The file name.
|
|
276
|
-
* @param transpiled - The transpiled code.
|
|
277
|
-
* @returns The compiler result.
|
|
278
|
-
*/
|
|
279
|
-
function generateSourceMap(code, id, transpiled) {
|
|
280
|
-
if (!transpiled) return;
|
|
281
|
-
const diff = dmp.diff_main(code.toString(), transpiled);
|
|
282
|
-
dmp.diff_cleanupSemantic(diff);
|
|
283
|
-
let offset = 0;
|
|
284
|
-
for (let index = 0; index < diff.length; index++) if (diff[index]) {
|
|
285
|
-
const [type, text] = diff[index];
|
|
286
|
-
const textLength = text.length;
|
|
287
|
-
switch (type) {
|
|
288
|
-
case 0:
|
|
289
|
-
offset += textLength;
|
|
290
|
-
break;
|
|
291
|
-
case 1:
|
|
292
|
-
code.prependLeft(offset, text);
|
|
293
|
-
break;
|
|
294
|
-
case -1: {
|
|
295
|
-
const next = diff.at(index + 1);
|
|
296
|
-
if (next && next[0] === 1) {
|
|
297
|
-
const replaceText = next[1];
|
|
298
|
-
const firstNonWhitespaceIndexOfText = text.search(/\S/);
|
|
299
|
-
const offsetStart = offset + Math.max(firstNonWhitespaceIndexOfText, 0);
|
|
300
|
-
code.update(offsetStart, offset + textLength, replaceText);
|
|
301
|
-
index += 1;
|
|
302
|
-
} else code.remove(offset, offset + textLength);
|
|
303
|
-
offset += textLength;
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (!code.hasChanged()) return;
|
|
309
|
-
return {
|
|
310
|
-
code: code.toString(),
|
|
311
|
-
map: code.generateMap({
|
|
312
|
-
source: id,
|
|
313
|
-
file: `${id}.map`,
|
|
314
|
-
includeContent: true
|
|
315
|
-
})
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region ../core/src/lib/utilities/write-file.ts
|
|
321
|
-
/**
|
|
322
|
-
* Writes and formats a file to the file system
|
|
323
|
-
*
|
|
324
|
-
* @param log - The logging function to use for logging errors
|
|
325
|
-
* @param filepath - The file path to write the file
|
|
326
|
-
* @param content - The content to write to the file
|
|
327
|
-
* @param skipFormat - Should the plugin skip formatting the `content` string with Prettier
|
|
328
|
-
*/
|
|
329
|
-
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
330
|
-
try {
|
|
331
|
-
if (skipFormat) await (0, __stryke_fs_write_file.writeFile)(filepath, content);
|
|
332
|
-
else await (0, __stryke_fs_write_file.writeFile)(filepath, await (0, prettier.format)(content, {
|
|
333
|
-
...await (0, prettier.resolveConfig)(filepath) ?? {},
|
|
334
|
-
filepath
|
|
335
|
-
}) || "");
|
|
336
|
-
} catch (error) {
|
|
337
|
-
log(__storm_software_config_tools_types.LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk \n${error?.message ? error.message : ""}`);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
//#endregion
|
|
342
|
-
Object.defineProperty(exports, 'createLog', {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
get: function () {
|
|
345
|
-
return createLog;
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
Object.defineProperty(exports, 'extendLog', {
|
|
349
|
-
enumerable: true,
|
|
350
|
-
get: function () {
|
|
351
|
-
return extendLog;
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
Object.defineProperty(exports, 'generateSourceMap', {
|
|
355
|
-
enumerable: true,
|
|
356
|
-
get: function () {
|
|
357
|
-
return generateSourceMap;
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
Object.defineProperty(exports, 'getFileHeader', {
|
|
361
|
-
enumerable: true,
|
|
362
|
-
get: function () {
|
|
363
|
-
return getFileHeader;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
Object.defineProperty(exports, 'getFileHeaderWarning', {
|
|
367
|
-
enumerable: true,
|
|
368
|
-
get: function () {
|
|
369
|
-
return getFileHeaderWarning;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
Object.defineProperty(exports, 'getFileHeaderWarningText', {
|
|
373
|
-
enumerable: true,
|
|
374
|
-
get: function () {
|
|
375
|
-
return getFileHeaderWarningText;
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
Object.defineProperty(exports, 'getMagicString', {
|
|
379
|
-
enumerable: true,
|
|
380
|
-
get: function () {
|
|
381
|
-
return getMagicString;
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
Object.defineProperty(exports, 'getSourceFile', {
|
|
385
|
-
enumerable: true,
|
|
386
|
-
get: function () {
|
|
387
|
-
return getSourceFile;
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
Object.defineProperty(exports, 'getString', {
|
|
391
|
-
enumerable: true,
|
|
392
|
-
get: function () {
|
|
393
|
-
return getString;
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
Object.defineProperty(exports, 'getTypescriptFileHeader', {
|
|
397
|
-
enumerable: true,
|
|
398
|
-
get: function () {
|
|
399
|
-
return getTypescriptFileHeader;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
Object.defineProperty(exports, 'getUniqueInputs', {
|
|
403
|
-
enumerable: true,
|
|
404
|
-
get: function () {
|
|
405
|
-
return getUniqueInputs;
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
Object.defineProperty(exports, 'isResolvedEntryTypeDefinition', {
|
|
409
|
-
enumerable: true,
|
|
410
|
-
get: function () {
|
|
411
|
-
return isResolvedEntryTypeDefinition;
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
Object.defineProperty(exports, 'isTypeDefinition', {
|
|
415
|
-
enumerable: true,
|
|
416
|
-
get: function () {
|
|
417
|
-
return isTypeDefinition;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
Object.defineProperty(exports, 'resolveEntryOutput', {
|
|
421
|
-
enumerable: true,
|
|
422
|
-
get: function () {
|
|
423
|
-
return resolveEntryOutput;
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
Object.defineProperty(exports, 'resolveInput', {
|
|
427
|
-
enumerable: true,
|
|
428
|
-
get: function () {
|
|
429
|
-
return resolveInput;
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
Object.defineProperty(exports, 'resolveInputs', {
|
|
433
|
-
enumerable: true,
|
|
434
|
-
get: function () {
|
|
435
|
-
return resolveInputs;
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
Object.defineProperty(exports, 'resolveInputsSync', {
|
|
439
|
-
enumerable: true,
|
|
440
|
-
get: function () {
|
|
441
|
-
return resolveInputsSync;
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
Object.defineProperty(exports, 'writeFile', {
|
|
445
|
-
enumerable: true,
|
|
446
|
-
get: function () {
|
|
447
|
-
return writeFile;
|
|
448
|
-
}
|
|
449
|
-
});
|