@powerlines/plugin-crypto 0.10.193 → 0.10.195

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.
@@ -13,7 +13,7 @@ function cryptoModule(context) {
13
13
  /**
14
14
  * The cryptography module provides custom helper functions to support encrypting and decrypting data.
15
15
  *
16
- * @module ${context.config.output.builtinPrefix}:crypto
16
+ * @module ${context.config.framework}:crypto
17
17
  */
18
18
 
19
19
  ${(0, powerlines_lib_utilities_file_header.getFileHeader)(context)}
@@ -12,7 +12,7 @@ function cryptoModule(context) {
12
12
  /**
13
13
  * The cryptography module provides custom helper functions to support encrypting and decrypting data.
14
14
  *
15
- * @module ${context.config.output.builtinPrefix}:crypto
15
+ * @module ${context.config.framework}:crypto
16
16
  */
17
17
 
18
18
  ${getFileHeader(context)}
package/dist/index.cjs CHANGED
@@ -5,7 +5,6 @@ require('./components/index.cjs');
5
5
  let __noble_ciphers_utils_js = require("@noble/ciphers/utils.js");
6
6
  let __powerlines_plugin_env = require("@powerlines/plugin-env");
7
7
  __powerlines_plugin_env = require_rolldown_runtime.__toESM(__powerlines_plugin_env);
8
- let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
9
8
  let defu = require("defu");
10
9
  defu = require_rolldown_runtime.__toESM(defu);
11
10
 
@@ -24,17 +23,17 @@ function plugin(options = {}) {
24
23
  this.dependencies["@noble/hashes"] = "^2.0.1";
25
24
  this.config.crypto.salt ??= this.env.parsed.SALT;
26
25
  if (!this.config.crypto.salt) {
27
- this.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the \`salt\` plugin option or the \`SALT\` environment variable.`);
26
+ this.warn(`No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the \`salt\` plugin option or the \`SALT\` environment variable.`);
28
27
  this.config.crypto.salt = (0, __noble_ciphers_utils_js.bytesToHex)((0, __noble_ciphers_utils_js.randomBytes)(12));
29
28
  }
30
29
  this.config.crypto.encryptionKey ??= this.env.parsed.ENCRYPTION_KEY;
31
30
  if (!this.config.crypto.encryptionKey) {
32
- this.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the \`encryptionKey\` plugin option or the \`ENCRYPTION_KEY\` environment variable.`);
31
+ this.warn(`No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the \`encryptionKey\` plugin option or the \`ENCRYPTION_KEY\` environment variable.`);
33
32
  this.config.crypto.encryptionKey = (0, __noble_ciphers_utils_js.bytesToHex)((0, __noble_ciphers_utils_js.randomBytes)(32));
34
33
  }
35
34
  },
36
35
  async prepare() {
37
- this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Preparing the Crypto runtime artifacts for the Powerlines project.`);
36
+ this.debug(`Preparing the Crypto runtime artifacts for the Powerlines project.`);
38
37
  await this.emitBuiltin(await Promise.resolve(require_crypto.cryptoModule(this)), "crypto");
39
38
  }
40
39
  }];
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@ import { cryptoModule } from "./components/crypto.mjs";
2
2
  import "./components/index.mjs";
3
3
  import { bytesToHex, randomBytes } from "@noble/ciphers/utils.js";
4
4
  import env from "@powerlines/plugin-env";
5
- import { LogLevelLabel } from "@storm-software/config-tools/types";
6
5
  import defu from "defu";
7
6
 
8
7
  //#region src/index.ts
@@ -20,17 +19,17 @@ function plugin(options = {}) {
20
19
  this.dependencies["@noble/hashes"] = "^2.0.1";
21
20
  this.config.crypto.salt ??= this.env.parsed.SALT;
22
21
  if (!this.config.crypto.salt) {
23
- this.log(LogLevelLabel.WARN, `No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the \`salt\` plugin option or the \`SALT\` environment variable.`);
22
+ this.warn(`No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the \`salt\` plugin option or the \`SALT\` environment variable.`);
24
23
  this.config.crypto.salt = bytesToHex(randomBytes(12));
25
24
  }
26
25
  this.config.crypto.encryptionKey ??= this.env.parsed.ENCRYPTION_KEY;
27
26
  if (!this.config.crypto.encryptionKey) {
28
- this.log(LogLevelLabel.WARN, `No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the \`encryptionKey\` plugin option or the \`ENCRYPTION_KEY\` environment variable.`);
27
+ this.warn(`No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the \`encryptionKey\` plugin option or the \`ENCRYPTION_KEY\` environment variable.`);
29
28
  this.config.crypto.encryptionKey = bytesToHex(randomBytes(32));
30
29
  }
31
30
  },
32
31
  async prepare() {
33
- this.log(LogLevelLabel.TRACE, `Preparing the Crypto runtime artifacts for the Powerlines project.`);
32
+ this.debug(`Preparing the Crypto runtime artifacts for the Powerlines project.`);
34
33
  await this.emitBuiltin(await Promise.resolve(cryptoModule(this)), "crypto");
35
34
  }
36
35
  }];
@@ -1,10 +1,8 @@
1
- import "../../../powerlines/src/types/config.mjs";
2
- import "../../../powerlines/src/types/resolved.mjs";
3
- import "../../../powerlines/src/types/context.mjs";
4
1
  import { TOCOptions } from "./toc.mjs";
5
2
  import { Config } from "automd";
6
3
 
7
4
  //#region ../plugin-automd/src/types/plugin.d.ts
5
+
8
6
  type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
9
7
  /**
10
8
  * Path to the AutoMD configuration file.
@@ -1,9 +1,7 @@
1
1
  import { Reflection } from "../../../deepkit/src/types.mjs";
2
2
  import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "../../../plugin-alloy/src/types/plugin.mjs";
3
- import "../../../plugin-alloy/src/types/index.mjs";
4
3
  import { AutoMDPluginOptions } from "../../../plugin-automd/src/types/plugin.mjs";
5
4
  import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.mjs";
6
- import "../../../plugin-babel/src/types/index.mjs";
7
5
  import { EnvInterface, SecretsInterface } from "./runtime.mjs";
8
6
  import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
9
7
  import { Children } from "@alloy-js/core";
@@ -1,5 +1,3 @@
1
- import "../../types/hooks.mjs";
2
- import "../../types/resolved.mjs";
3
1
  import { SelectHooksOptions } from "../../types/context.mjs";
4
2
  import { MaybePromise } from "@stryke/types/base";
5
3
 
@@ -1,4 +1,3 @@
1
- import "./context.mjs";
2
1
  import { ArrayValues } from "@stryke/types/array";
3
2
  import { MaybePromise } from "@stryke/types/base";
4
3
 
@@ -15,6 +15,7 @@ import { AssetGlob } from "@stryke/types/file";
15
15
  import { DateString } from "compatx";
16
16
 
17
17
  //#region ../powerlines/src/types/config.d.ts
18
+ type LogLevel = "error" | "warn" | "info" | "debug" | "trace";
18
19
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
19
20
  /**
20
21
  * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
@@ -102,15 +103,6 @@ interface OutputConfig {
102
103
  * @defaultValue "\{projectRoot\}/powerlines.d.ts"
103
104
  */
104
105
  dts?: string | false;
105
- /**
106
- * A prefix to use for identifying builtin modules
107
- *
108
- * @remarks
109
- * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
110
- *
111
- * @defaultValue "powerlines"
112
- */
113
- builtinPrefix?: string;
114
106
  /**
115
107
  * The module format of the output files
116
108
  *
@@ -273,7 +265,7 @@ interface CommonUserConfig extends BaseConfig {
273
265
  *
274
266
  * @defaultValue "info"
275
267
  */
276
- logLevel?: LogLevelLabel | null;
268
+ logLevel?: LogLevel | null;
277
269
  /**
278
270
  * A custom logger function to use for logging messages
279
271
  */
@@ -346,7 +338,7 @@ interface CommonUserConfig extends BaseConfig {
346
338
  * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
347
339
  *
348
340
  * @remarks
349
- * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
341
+ * If no values are provided for {@link OutputConfig.dts | output.dts} or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
350
342
  *
351
343
  * @defaultValue "powerlines"
352
344
  */
@@ -440,4 +432,4 @@ type DeployInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Inlin
440
432
  command: "deploy";
441
433
  };
442
434
  //#endregion
443
- export { BabelUserConfig, BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
435
+ export { BabelUserConfig, BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
@@ -4,17 +4,18 @@ import { StoragePort, StoragePreset } from "./fs.mjs";
4
4
  import { TSConfig } from "./tsconfig.mjs";
5
5
  import { PluginContext } from "./context.mjs";
6
6
  import { Plugin } from "./plugin.mjs";
7
- import { LogLevelLabel } from "@storm-software/config-tools/types";
8
7
  import { MaybePromise } from "@stryke/types/base";
9
8
  import { PreviewOptions } from "vite";
10
9
  import { transformAsync } from "@babel/core";
11
10
  import { Format } from "@storm-software/build-tools/types";
11
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
12
12
  import { StormWorkspaceConfig } from "@storm-software/config/types";
13
13
  import { TypeDefinitionParameter } from "@stryke/types/configuration";
14
14
  import { AssetGlob } from "@stryke/types/file";
15
15
  import { DateString } from "compatx";
16
16
 
17
17
  //#region ../powerlines/src/types/config.d.ts
18
+ type LogLevel = "error" | "warn" | "info" | "debug" | "trace";
18
19
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
19
20
  /**
20
21
  * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
@@ -102,15 +103,6 @@ interface OutputConfig {
102
103
  * @defaultValue "\{projectRoot\}/powerlines.d.ts"
103
104
  */
104
105
  dts?: string | false;
105
- /**
106
- * A prefix to use for identifying builtin modules
107
- *
108
- * @remarks
109
- * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
110
- *
111
- * @defaultValue "powerlines"
112
- */
113
- builtinPrefix?: string;
114
106
  /**
115
107
  * The module format of the output files
116
108
  *
@@ -273,7 +265,7 @@ interface CommonUserConfig extends BaseConfig {
273
265
  *
274
266
  * @defaultValue "info"
275
267
  */
276
- logLevel?: LogLevelLabel | null;
268
+ logLevel?: LogLevel | null;
277
269
  /**
278
270
  * A custom logger function to use for logging messages
279
271
  */
@@ -346,7 +338,7 @@ interface CommonUserConfig extends BaseConfig {
346
338
  * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
347
339
  *
348
340
  * @remarks
349
- * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
341
+ * If no values are provided for {@link OutputConfig.dts | output.dts} or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
350
342
  *
351
343
  * @defaultValue "powerlines"
352
344
  */
@@ -440,4 +432,4 @@ type DeployInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Inlin
440
432
  command: "deploy";
441
433
  };
442
434
  //#endregion
443
- export { BabelUserConfig, BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
435
+ export { BabelUserConfig, BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
@@ -226,6 +226,13 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
226
226
  * The builtin module id that exist in the Powerlines virtual file system
227
227
  */
228
228
  builtins: string[];
229
+ /**
230
+ * The alias mappings for the project used during module resolution
231
+ *
232
+ * @remarks
233
+ * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.
234
+ */
235
+ alias: Record<string, string>;
229
236
  /**
230
237
  * The {@link Project} instance used for type reflection and module manipulation
231
238
  *
@@ -226,6 +226,13 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
226
226
  * The builtin module id that exist in the Powerlines virtual file system
227
227
  */
228
228
  builtins: string[];
229
+ /**
230
+ * The alias mappings for the project used during module resolution
231
+ *
232
+ * @remarks
233
+ * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.
234
+ */
235
+ alias: Record<string, string>;
229
236
  /**
230
237
  * The {@link Project} instance used for type reflection and module manipulation
231
238
  *
@@ -1,5 +1,5 @@
1
1
  import { BuilderVariant } from "./build.cjs";
2
- import { BabelUserConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.cjs";
2
+ import { BabelUserConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LogLevel, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.cjs";
3
3
  import { NonUndefined } from "@stryke/types/base";
4
4
  import { ResolvedPreviewOptions } from "vite";
5
5
  import { TypeDefinition } from "@stryke/types/configuration";
@@ -77,7 +77,7 @@ type ResolvedConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Omit<TUse
77
77
  *
78
78
  * @defaultValue "info"
79
79
  */
80
- logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
80
+ logLevel: LogLevel | null;
81
81
  };
82
82
  type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
83
83
  type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
@@ -1,5 +1,5 @@
1
1
  import { BuilderVariant } from "./build.mjs";
2
- import { BabelUserConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.mjs";
2
+ import { BabelUserConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LogLevel, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.mjs";
3
3
  import { NonUndefined } from "@stryke/types/base";
4
4
  import { ResolvedPreviewOptions } from "vite";
5
5
  import { TypeDefinition } from "@stryke/types/configuration";
@@ -77,7 +77,7 @@ type ResolvedConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Omit<TUse
77
77
  *
78
78
  * @defaultValue "info"
79
79
  */
80
- logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
80
+ logLevel: LogLevel | null;
81
81
  };
82
82
  type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
83
83
  type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
@@ -1,5 +1,4 @@
1
1
  import { BuilderVariant, InferUnpluginVariant, UnpluginBuilderVariant } from "./build.mjs";
2
- import "./config.mjs";
3
2
  import { InferResolvedConfig } from "./resolved.mjs";
4
3
  import { Context } from "./context.mjs";
5
4
  import { API } from "./api.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-crypto",
3
- "version": "0.10.193",
3
+ "version": "0.10.195",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin that provides unique identifier generation capabilities at runtime by adding the `id` builtin module.",
6
6
  "repository": {
@@ -129,16 +129,16 @@
129
129
  "keywords": ["powerlines", "storm-software", "powerlines-plugin"],
130
130
  "dependencies": {
131
131
  "@noble/ciphers": "^2.1.1",
132
- "@powerlines/plugin-env": "^0.15.90",
132
+ "@powerlines/plugin-env": "^0.15.92",
133
133
  "@storm-software/config-tools": "^1.188.80",
134
134
  "@stryke/path": "^0.26.0",
135
135
  "defu": "^6.1.4",
136
- "powerlines": "^0.37.71"
136
+ "powerlines": "^0.37.73"
137
137
  },
138
138
  "devDependencies": {
139
- "@powerlines/plugin-plugin": "^0.12.149",
139
+ "@powerlines/plugin-plugin": "^0.12.151",
140
140
  "@types/node": "^24.10.9"
141
141
  },
142
142
  "publishConfig": { "access": "public" },
143
- "gitHead": "6fd6de6c956acc53f73c34d8b19827d094e604af"
143
+ "gitHead": "df743ef7ebac849eb4ce90899884df4758b61172"
144
144
  }
@@ -1,2 +0,0 @@
1
- import "../../../powerlines/src/types/resolved.mjs";
2
- import { Children } from "@alloy-js/core";
@@ -1,2 +0,0 @@
1
- import "./components.mjs";
2
- import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.mjs";
@@ -1 +0,0 @@
1
- import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "./plugin.mjs";