powerlines 0.21.0 → 0.22.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.
@@ -0,0 +1,41 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+ import { isSetObject } from '@stryke/type-checks/is-set-object';
3
+ import { isSetString } from '@stryke/type-checks/is-set-string';
4
+
5
+ function getOrganizationName(context) {
6
+ let result;
7
+ if (isSetObject(context.workspaceConfig.organization)) {
8
+ result = context.workspaceConfig.organization.name;
9
+ }
10
+ if (!result && isSetString(context.workspaceConfig.organization)) {
11
+ result = context.workspaceConfig.organization;
12
+ }
13
+ if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
14
+ if (isSetObject(context.packageJson.maintainers[0])) {
15
+ result = context.packageJson.maintainers[0].name;
16
+ }
17
+ if (!result && isSetString(context.packageJson.maintainers[0])) {
18
+ result = context.packageJson.maintainers[0];
19
+ }
20
+ }
21
+ if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
22
+ if (isSetObject(context.packageJson.author[0])) {
23
+ result = context.packageJson.author[0].name;
24
+ }
25
+ if (!result && isSetString(context.packageJson.author[0])) {
26
+ result = context.packageJson.author[0];
27
+ }
28
+ }
29
+ if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
30
+ if (isSetObject(context.packageJson.contributors[0])) {
31
+ result = context.packageJson.contributors[0].name;
32
+ }
33
+ if (!result && isSetString(context.packageJson.contributors[0])) {
34
+ result = context.packageJson.contributors[0];
35
+ }
36
+ }
37
+ return result;
38
+ }
39
+ __name(getOrganizationName, "getOrganizationName");
40
+
41
+ export { getOrganizationName };
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
+ var isSetObject = require('@stryke/type-checks/is-set-object');
5
+ var isSetString = require('@stryke/type-checks/is-set-string');
6
+
7
+ function getOrganizationName(context) {
8
+ let result;
9
+ if (isSetObject.isSetObject(context.workspaceConfig.organization)) {
10
+ result = context.workspaceConfig.organization.name;
11
+ }
12
+ if (!result && isSetString.isSetString(context.workspaceConfig.organization)) {
13
+ result = context.workspaceConfig.organization;
14
+ }
15
+ if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
16
+ if (isSetObject.isSetObject(context.packageJson.maintainers[0])) {
17
+ result = context.packageJson.maintainers[0].name;
18
+ }
19
+ if (!result && isSetString.isSetString(context.packageJson.maintainers[0])) {
20
+ result = context.packageJson.maintainers[0];
21
+ }
22
+ }
23
+ if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
24
+ if (isSetObject.isSetObject(context.packageJson.author[0])) {
25
+ result = context.packageJson.author[0].name;
26
+ }
27
+ if (!result && isSetString.isSetString(context.packageJson.author[0])) {
28
+ result = context.packageJson.author[0];
29
+ }
30
+ }
31
+ if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
32
+ if (isSetObject.isSetObject(context.packageJson.contributors[0])) {
33
+ result = context.packageJson.contributors[0].name;
34
+ }
35
+ if (!result && isSetString.isSetString(context.packageJson.contributors[0])) {
36
+ result = context.packageJson.contributors[0];
37
+ }
38
+ }
39
+ return result;
40
+ }
41
+ chunkUSNT2KNT_cjs.__name(getOrganizationName, "getOrganizationName");
42
+
43
+ exports.getOrganizationName = getOrganizationName;
@@ -1,21 +1,21 @@
1
+ import { EnvPaths } from '@stryke/env/get-env-paths';
2
+ import { NonUndefined, MaybePromise, FunctionLike, DeepPartial as DeepPartial$1 } from '@stryke/types/base';
3
+ import { PackageJson } from '@stryke/types/package-json';
4
+ import { Jiti } from 'jiti';
5
+ import { ParserOptions, ParseResult } from 'oxc-parser';
6
+ import { Range } from 'semver';
7
+ import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginBuildContext, UnpluginMessage } from 'unplugin';
1
8
  import { Format } from '@storm-software/build-tools/types';
2
9
  import { LogLevelLabel } from '@storm-software/config-tools/types';
3
10
  import { StormWorkspaceConfig } from '@storm-software/config/types';
4
- import { NonUndefined, MaybePromise, FunctionLike, DeepPartial as DeepPartial$1 } from '@stryke/types/base';
5
11
  import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configuration';
6
12
  import { AssetGlob } from '@stryke/types/file';
7
13
  import { ResolvedPreviewOptions, PreviewOptions } from 'vite';
8
- import { EnvPaths } from '@stryke/env/get-env-paths';
9
- import { PackageJson } from '@stryke/types/package-json';
10
- import { Jiti } from 'jiti';
11
- import { ParserOptions, ParseResult } from 'oxc-parser';
12
- import { Range } from 'semver';
13
- import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginMessage, UnpluginBuildContext, UnpluginContext } from 'unplugin';
14
- import { ArrayValues } from '@stryke/types/array';
15
14
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
16
15
  import ts from 'typescript';
17
16
  import { PrimitiveJsonValue } from '@stryke/json/types';
18
17
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
18
+ import { ArrayValues } from '@stryke/types/array';
19
19
 
20
20
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
21
21
  type BuildVariant = UnpluginBuildVariant | "tsup" | "unbuild";
@@ -895,238 +895,6 @@ interface VirtualFileSystemInterface {
895
895
  dispose: () => Promise<void>;
896
896
  }
897
897
 
898
- interface MetaInfo {
899
- /**
900
- * The checksum generated from the resolved options
901
- */
902
- checksum: string;
903
- /**
904
- * The build id
905
- */
906
- buildId: string;
907
- /**
908
- * The release id
909
- */
910
- releaseId: string;
911
- /**
912
- * The build timestamp
913
- */
914
- timestamp: number;
915
- /**
916
- * A hash that represents the path to the project root directory
917
- */
918
- projectRootHash: string;
919
- /**
920
- * A hash that represents the path to the project root directory
921
- */
922
- configHash: string;
923
- }
924
- interface Resolver extends Jiti {
925
- plugin: Jiti;
926
- }
927
- interface InitContextOptions {
928
- /**
929
- * If false, the plugin will be loaded after all other plugins.
930
- *
931
- * @defaultValue true
932
- */
933
- isHighPriority: boolean;
934
- }
935
- /**
936
- * The unresolved Powerlines context.
937
- *
938
- * @remarks
939
- * This context is used before the user configuration has been fully resolved after the `config`.
940
- */
941
- interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
942
- /**
943
- * The Storm workspace configuration
944
- */
945
- workspaceConfig: WorkspaceConfig;
946
- /**
947
- * An object containing the options provided to Powerlines
948
- */
949
- config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
950
- projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
951
- output: TResolvedConfig["output"];
952
- };
953
- /**
954
- * A logging function for the Powerlines engine
955
- */
956
- log: LogFn;
957
- /**
958
- * A logging function for fatal messages
959
- */
960
- fatal: (message: string | UnpluginMessage) => void;
961
- /**
962
- * A logging function for error messages
963
- */
964
- error: (message: string | UnpluginMessage) => void;
965
- /**
966
- * A logging function for warning messages
967
- */
968
- warn: (message: string | UnpluginMessage) => void;
969
- /**
970
- * A logging function for informational messages
971
- */
972
- info: (message: string | UnpluginMessage) => void;
973
- /**
974
- * A logging function for debug messages
975
- */
976
- debug: (message: string | UnpluginMessage) => void;
977
- /**
978
- * A logging function for trace messages
979
- */
980
- trace: (message: string | UnpluginMessage) => void;
981
- /**
982
- * The metadata information
983
- */
984
- meta: MetaInfo;
985
- /**
986
- * The metadata information currently written to disk
987
- */
988
- persistedMeta?: MetaInfo;
989
- /**
990
- * The Powerlines artifacts directory
991
- */
992
- artifactsPath: string;
993
- /**
994
- * The path to the Powerlines builtin runtime modules directory
995
- */
996
- builtinsPath: string;
997
- /**
998
- * The path to the Powerlines entry modules directory
999
- */
1000
- entryPath: string;
1001
- /**
1002
- * The path to the Powerlines TypeScript declaration files directory
1003
- */
1004
- dtsPath: string;
1005
- /**
1006
- * The path to a directory where the reflection data buffers (used by the build processes) are stored
1007
- */
1008
- dataPath: string;
1009
- /**
1010
- * The path to a directory where the project cache (used by the build processes) is stored
1011
- */
1012
- cachePath: string;
1013
- /**
1014
- * The Powerlines environment paths
1015
- */
1016
- envPaths: EnvPaths;
1017
- /**
1018
- * The file system path to the Powerlines package installation
1019
- */
1020
- powerlinesPath: string;
1021
- /**
1022
- * The relative path to the Powerlines workspace root directory
1023
- */
1024
- relativeToWorkspaceRoot: string;
1025
- /**
1026
- * The project's `package.json` file content
1027
- */
1028
- packageJson: PackageJson & Record<string, any>;
1029
- /**
1030
- * The project's `project.json` file content
1031
- */
1032
- projectJson?: Record<string, any>;
1033
- /**
1034
- * The dependency installations required by the project
1035
- */
1036
- dependencies: Record<string, string | Range>;
1037
- /**
1038
- * The development dependency installations required by the project
1039
- */
1040
- devDependencies: Record<string, string | Range>;
1041
- /**
1042
- * The parsed TypeScript configuration from the `tsconfig.json` file
1043
- */
1044
- tsconfig: ParsedTypeScriptConfig;
1045
- /**
1046
- * The entry points of the source code
1047
- */
1048
- entry: ResolvedEntryTypeDefinition[];
1049
- /**
1050
- * The virtual file system manager used during the build process to reference generated runtime files
1051
- */
1052
- fs: VirtualFileSystemInterface;
1053
- /**
1054
- * The Jiti module resolver
1055
- */
1056
- resolver: Resolver;
1057
- /**
1058
- * The builtin module id that exist in the Powerlines virtual file system
1059
- */
1060
- builtins: string[];
1061
- /**
1062
- * The Powerlines builtin virtual files
1063
- */
1064
- getBuiltins: () => Promise<VirtualFile[]>;
1065
- /**
1066
- * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1067
- *
1068
- * @param code - The source code of the builtin file
1069
- * @param id - The unique identifier of the builtin file
1070
- * @param path - An optional path to write the builtin file to
1071
- * @param options - Options for writing the file
1072
- */
1073
- writeBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1074
- /**
1075
- * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1076
- *
1077
- * @param code - The source code of the entry file
1078
- * @param path - An optional path to write the entry file to
1079
- * @param options - Options for writing the file
1080
- */
1081
- writeEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1082
- /**
1083
- * Parses the source code and returns a {@link ParseResult} object.
1084
- */
1085
- parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
1086
- /**
1087
- * A function to update the context fields using a new user configuration options
1088
- */
1089
- withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
1090
- /**
1091
- * A function to update the context fields using inline configuration options
1092
- */
1093
- withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1094
- /**
1095
- * Create a new logger instance
1096
- *
1097
- * @param name - The name to use for the logger instance
1098
- * @returns A logger function
1099
- */
1100
- createLog: (name: string | null) => LogFn;
1101
- /**
1102
- * Extend the current logger instance with a new name
1103
- *
1104
- * @param name - The name to use for the extended logger instance
1105
- * @returns A logger function
1106
- */
1107
- extendLog: (name: string) => LogFn;
1108
- }
1109
- type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1110
- /**
1111
- * The fully resolved Powerlines configuration
1112
- */
1113
- config: TResolvedConfig;
1114
- };
1115
- interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1116
- /**
1117
- * The environment specific resolved configuration
1118
- */
1119
- environment: EnvironmentResolvedConfig;
1120
- /**
1121
- * An alternative property name for the {@link log} property
1122
- *
1123
- * @remarks
1124
- * This is provided for compatibility with other logging libraries that expect a `logger` property.
1125
- */
1126
- logger: LogFn;
1127
- }
1128
- type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1129
-
1130
898
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
1131
899
  /**
1132
900
  * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
@@ -1419,4 +1187,236 @@ type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserCo
1419
1187
  command: PowerlinesCommand;
1420
1188
  };
1421
1189
 
1190
+ interface MetaInfo {
1191
+ /**
1192
+ * The checksum generated from the resolved options
1193
+ */
1194
+ checksum: string;
1195
+ /**
1196
+ * The build id
1197
+ */
1198
+ buildId: string;
1199
+ /**
1200
+ * The release id
1201
+ */
1202
+ releaseId: string;
1203
+ /**
1204
+ * The build timestamp
1205
+ */
1206
+ timestamp: number;
1207
+ /**
1208
+ * A hash that represents the path to the project root directory
1209
+ */
1210
+ projectRootHash: string;
1211
+ /**
1212
+ * A hash that represents the path to the project root directory
1213
+ */
1214
+ configHash: string;
1215
+ }
1216
+ interface Resolver extends Jiti {
1217
+ plugin: Jiti;
1218
+ }
1219
+ interface InitContextOptions {
1220
+ /**
1221
+ * If false, the plugin will be loaded after all other plugins.
1222
+ *
1223
+ * @defaultValue true
1224
+ */
1225
+ isHighPriority: boolean;
1226
+ }
1227
+ /**
1228
+ * The unresolved Powerlines context.
1229
+ *
1230
+ * @remarks
1231
+ * This context is used before the user configuration has been fully resolved after the `config`.
1232
+ */
1233
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1234
+ /**
1235
+ * The Storm workspace configuration
1236
+ */
1237
+ workspaceConfig: WorkspaceConfig;
1238
+ /**
1239
+ * An object containing the options provided to Powerlines
1240
+ */
1241
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1242
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1243
+ output: TResolvedConfig["output"];
1244
+ };
1245
+ /**
1246
+ * A logging function for the Powerlines engine
1247
+ */
1248
+ log: LogFn;
1249
+ /**
1250
+ * A logging function for fatal messages
1251
+ */
1252
+ fatal: (message: string | UnpluginMessage) => void;
1253
+ /**
1254
+ * A logging function for error messages
1255
+ */
1256
+ error: (message: string | UnpluginMessage) => void;
1257
+ /**
1258
+ * A logging function for warning messages
1259
+ */
1260
+ warn: (message: string | UnpluginMessage) => void;
1261
+ /**
1262
+ * A logging function for informational messages
1263
+ */
1264
+ info: (message: string | UnpluginMessage) => void;
1265
+ /**
1266
+ * A logging function for debug messages
1267
+ */
1268
+ debug: (message: string | UnpluginMessage) => void;
1269
+ /**
1270
+ * A logging function for trace messages
1271
+ */
1272
+ trace: (message: string | UnpluginMessage) => void;
1273
+ /**
1274
+ * The metadata information
1275
+ */
1276
+ meta: MetaInfo;
1277
+ /**
1278
+ * The metadata information currently written to disk
1279
+ */
1280
+ persistedMeta?: MetaInfo;
1281
+ /**
1282
+ * The Powerlines artifacts directory
1283
+ */
1284
+ artifactsPath: string;
1285
+ /**
1286
+ * The path to the Powerlines builtin runtime modules directory
1287
+ */
1288
+ builtinsPath: string;
1289
+ /**
1290
+ * The path to the Powerlines entry modules directory
1291
+ */
1292
+ entryPath: string;
1293
+ /**
1294
+ * The path to the Powerlines TypeScript declaration files directory
1295
+ */
1296
+ dtsPath: string;
1297
+ /**
1298
+ * The path to a directory where the reflection data buffers (used by the build processes) are stored
1299
+ */
1300
+ dataPath: string;
1301
+ /**
1302
+ * The path to a directory where the project cache (used by the build processes) is stored
1303
+ */
1304
+ cachePath: string;
1305
+ /**
1306
+ * The Powerlines environment paths
1307
+ */
1308
+ envPaths: EnvPaths;
1309
+ /**
1310
+ * The file system path to the Powerlines package installation
1311
+ */
1312
+ powerlinesPath: string;
1313
+ /**
1314
+ * The relative path to the Powerlines workspace root directory
1315
+ */
1316
+ relativeToWorkspaceRoot: string;
1317
+ /**
1318
+ * The project's `package.json` file content
1319
+ */
1320
+ packageJson: PackageJson & Record<string, any>;
1321
+ /**
1322
+ * The project's `project.json` file content
1323
+ */
1324
+ projectJson?: Record<string, any>;
1325
+ /**
1326
+ * The dependency installations required by the project
1327
+ */
1328
+ dependencies: Record<string, string | Range>;
1329
+ /**
1330
+ * The development dependency installations required by the project
1331
+ */
1332
+ devDependencies: Record<string, string | Range>;
1333
+ /**
1334
+ * The parsed TypeScript configuration from the `tsconfig.json` file
1335
+ */
1336
+ tsconfig: ParsedTypeScriptConfig;
1337
+ /**
1338
+ * The entry points of the source code
1339
+ */
1340
+ entry: ResolvedEntryTypeDefinition[];
1341
+ /**
1342
+ * The virtual file system manager used during the build process to reference generated runtime files
1343
+ */
1344
+ fs: VirtualFileSystemInterface;
1345
+ /**
1346
+ * The Jiti module resolver
1347
+ */
1348
+ resolver: Resolver;
1349
+ /**
1350
+ * The builtin module id that exist in the Powerlines virtual file system
1351
+ */
1352
+ builtins: string[];
1353
+ /**
1354
+ * The Powerlines builtin virtual files
1355
+ */
1356
+ getBuiltins: () => Promise<VirtualFile[]>;
1357
+ /**
1358
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1359
+ *
1360
+ * @param code - The source code of the builtin file
1361
+ * @param id - The unique identifier of the builtin file
1362
+ * @param path - An optional path to write the builtin file to
1363
+ * @param options - Options for writing the file
1364
+ */
1365
+ writeBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1366
+ /**
1367
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1368
+ *
1369
+ * @param code - The source code of the entry file
1370
+ * @param path - An optional path to write the entry file to
1371
+ * @param options - Options for writing the file
1372
+ */
1373
+ writeEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1374
+ /**
1375
+ * Parses the source code and returns a {@link ParseResult} object.
1376
+ */
1377
+ parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
1378
+ /**
1379
+ * A function to update the context fields using a new user configuration options
1380
+ */
1381
+ withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
1382
+ /**
1383
+ * A function to update the context fields using inline configuration options
1384
+ */
1385
+ withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1386
+ /**
1387
+ * Create a new logger instance
1388
+ *
1389
+ * @param name - The name to use for the logger instance
1390
+ * @returns A logger function
1391
+ */
1392
+ createLog: (name: string | null) => LogFn;
1393
+ /**
1394
+ * Extend the current logger instance with a new name
1395
+ *
1396
+ * @param name - The name to use for the extended logger instance
1397
+ * @returns A logger function
1398
+ */
1399
+ extendLog: (name: string) => LogFn;
1400
+ }
1401
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1402
+ /**
1403
+ * The fully resolved Powerlines configuration
1404
+ */
1405
+ config: TResolvedConfig;
1406
+ };
1407
+ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1408
+ /**
1409
+ * The environment specific resolved configuration
1410
+ */
1411
+ environment: EnvironmentResolvedConfig;
1412
+ /**
1413
+ * An alternative property name for the {@link log} property
1414
+ *
1415
+ * @remarks
1416
+ * This is provided for compatibility with other logging libraries that expect a `logger` property.
1417
+ */
1418
+ logger: LogFn;
1419
+ }
1420
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1421
+
1422
1422
  export type { BuildVariant as B, ConfigResult as C, ExternalPluginHookFunctions as E, GenerateTypesResult as G, PluginContext as P, ResolvedConfig as R, UnresolvedContext as U, Plugin as a, PluginFactory as b, PartialPlugin as c, PartialPluginFactory as d, BasePluginHookFunctions as e, PluginHookFunctions as f, PluginHookObject as g, PluginConfigObject as h, PluginConfigTuple as i, PluginConfig as j, PluginHook as k, EnvironmentConfig as l, EnvironmentResolvedConfig as m };