@powerlines/plugin-style-dictionary 0.3.29 → 0.3.30

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.
Files changed (30) hide show
  1. package/dist/index.cjs +10 -10
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.mjs +2 -2
  4. package/dist/node_modules/.pnpm/@storm-software_config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.cjs +16 -0
  5. package/dist/node_modules/.pnpm/@storm-software_config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.mjs +15 -0
  6. package/dist/{powerlines → packages/powerlines}/src/internal/helpers/hooks.d.mts +0 -2
  7. package/dist/{powerlines → packages/powerlines}/src/types/build.d.mts +6 -6
  8. package/dist/{powerlines → packages/powerlines}/src/types/commands.d.mts +0 -1
  9. package/dist/{powerlines → packages/powerlines}/src/types/config.d.mts +2 -2
  10. package/dist/{powerlines → packages/powerlines}/src/types/unplugin.d.mts +0 -1
  11. package/dist/types/plugin.d.mts +3 -3
  12. package/package.json +4 -5
  13. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  14. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  15. package/dist/powerlines/src/lib/entry.cjs +0 -12
  16. package/dist/powerlines/src/lib/entry.mjs +0 -14
  17. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  18. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  19. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  20. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  21. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  22. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  23. package/dist/powerlines/src/types/babel.d.mts +0 -2
  24. /package/dist/{powerlines → packages/powerlines}/src/types/api.d.mts +0 -0
  25. /package/dist/{powerlines → packages/powerlines}/src/types/context.d.mts +0 -0
  26. /package/dist/{powerlines → packages/powerlines}/src/types/fs.d.mts +0 -0
  27. /package/dist/{powerlines → packages/powerlines}/src/types/hooks.d.mts +0 -0
  28. /package/dist/{powerlines → packages/powerlines}/src/types/plugin.d.mts +0 -0
  29. /package/dist/{powerlines → packages/powerlines}/src/types/resolved.d.mts +0 -0
  30. /package/dist/{powerlines → packages/powerlines}/src/types/tsconfig.d.mts +0 -0
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_resolve = require('./powerlines/src/lib/utilities/resolve.cjs');
3
+ const require_chunk_POXTJ6GF = require('./node_modules/.pnpm/@storm-software_config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.cjs');
4
4
  const require_file_header = require('./style-dictionary/file-header.cjs');
5
- let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
6
5
  let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
7
6
  let defu = require("defu");
8
7
  defu = require_rolldown_runtime.__toESM(defu);
8
+ let powerlines_lib_utilities_resolve = require("powerlines/lib/utilities/resolve");
9
9
  let style_dictionary = require("style-dictionary");
10
10
  style_dictionary = require_rolldown_runtime.__toESM(style_dictionary);
11
11
 
@@ -21,7 +21,7 @@ const plugin = (options = {}) => {
21
21
  name: "style-dictionary",
22
22
  config() {
23
23
  return { styleDictionary: (0, defu.default)(options, {
24
- log: { verbosity: this.config.logLevel === __storm_software_config_tools_types.LogLevelLabel.DEBUG || this.config.logLevel === __storm_software_config_tools_types.LogLevelLabel.TRACE ? "verbose" : this.config.logLevel === null ? "silent" : void 0 },
24
+ log: { verbosity: this.config.logLevel === require_chunk_POXTJ6GF.LogLevelLabel.DEBUG || this.config.logLevel === require_chunk_POXTJ6GF.LogLevelLabel.TRACE ? "verbose" : this.config.logLevel === null ? "silent" : void 0 },
25
25
  fileHeader: "powerlines/file-header"
26
26
  }) };
27
27
  },
@@ -31,7 +31,7 @@ const plugin = (options = {}) => {
31
31
  if (this.config.styleDictionary.customActions) {
32
32
  let builder;
33
33
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customActions)) builder = this.config.styleDictionary.customActions;
34
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customActions);
34
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customActions);
35
35
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, action]) => {
36
36
  this.styleDictionary.registerAction({
37
37
  ...action,
@@ -42,7 +42,7 @@ const plugin = (options = {}) => {
42
42
  if (this.config.styleDictionary.customFileHeaders) {
43
43
  let builder;
44
44
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFileHeaders)) builder = this.config.styleDictionary.customFileHeaders;
45
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customFileHeaders);
45
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customFileHeaders);
46
46
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, fileHeader$1]) => {
47
47
  this.styleDictionary.registerFileHeader({
48
48
  name,
@@ -53,7 +53,7 @@ const plugin = (options = {}) => {
53
53
  if (this.config.styleDictionary.customFilters) {
54
54
  let builder;
55
55
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFilters)) builder = this.config.styleDictionary.customFilters;
56
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customFilters);
56
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customFilters);
57
57
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, filter]) => {
58
58
  this.styleDictionary.registerFilter({
59
59
  ...filter,
@@ -64,7 +64,7 @@ const plugin = (options = {}) => {
64
64
  if (this.config.styleDictionary.customPreprocessors) {
65
65
  let builder;
66
66
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customPreprocessors)) builder = this.config.styleDictionary.customPreprocessors;
67
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customPreprocessors);
67
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customPreprocessors);
68
68
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, preprocessor]) => {
69
69
  this.styleDictionary.registerPreprocessor({
70
70
  ...preprocessor,
@@ -75,7 +75,7 @@ const plugin = (options = {}) => {
75
75
  if (this.config.styleDictionary.customParsers) {
76
76
  let builder;
77
77
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customParsers)) builder = this.config.styleDictionary.customParsers;
78
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customParsers);
78
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customParsers);
79
79
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, parser]) => {
80
80
  this.styleDictionary.registerParser({
81
81
  ...parser,
@@ -86,7 +86,7 @@ const plugin = (options = {}) => {
86
86
  if (this.config.styleDictionary.customTransforms) {
87
87
  let builder;
88
88
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransforms)) builder = this.config.styleDictionary.customTransforms;
89
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customTransforms);
89
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customTransforms);
90
90
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transform]) => {
91
91
  this.styleDictionary.registerTransform({
92
92
  ...transform,
@@ -97,7 +97,7 @@ const plugin = (options = {}) => {
97
97
  if (this.config.styleDictionary.customTransformGroups) {
98
98
  let builder;
99
99
  if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransformGroups)) builder = this.config.styleDictionary.customTransformGroups;
100
- else builder = await require_resolve.resolve(this, this.config.styleDictionary.customTransformGroups);
100
+ else builder = await (0, powerlines_lib_utilities_resolve.resolve)(this, this.config.styleDictionary.customTransformGroups);
101
101
  Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transformGroup]) => {
102
102
  this.styleDictionary.registerTransformGroup({
103
103
  name,
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Plugin } from "./powerlines/src/types/plugin.mjs";
1
+ import { Plugin } from "./packages/powerlines/src/types/plugin.mjs";
2
2
  import { CustomActionsBuilder, CustomFileHeadersBuilder, CustomFiltersBuilder, CustomFormatsBuilder, CustomParsersBuilder, CustomPreprocessorsBuilder, CustomTransformGroupsBuilder, CustomTransformsBuilder, StyleDictionaryPluginContext, StyleDictionaryPluginEnvironmentConfig, StyleDictionaryPluginOptions, StyleDictionaryPluginResolvedConfig, StyleDictionaryPluginUserConfig, __ΩCustomActionsBuilder, __ΩCustomFileHeadersBuilder, __ΩCustomFiltersBuilder, __ΩCustomFormatsBuilder, __ΩCustomParsersBuilder, __ΩCustomPreprocessorsBuilder, __ΩCustomTransformGroupsBuilder, __ΩCustomTransformsBuilder, __ΩStyleDictionaryPluginContext, __ΩStyleDictionaryPluginEnvironmentConfig, __ΩStyleDictionaryPluginOptions, __ΩStyleDictionaryPluginResolvedConfig, __ΩStyleDictionaryPluginUserConfig } from "./types/plugin.mjs";
3
3
  import "./types/index.mjs";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { resolve } from "./powerlines/src/lib/utilities/resolve.mjs";
1
+ import { LogLevelLabel } from "./node_modules/.pnpm/@storm-software_config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.mjs";
2
2
  import { fileHeader } from "./style-dictionary/file-header.mjs";
3
- import { LogLevelLabel } from "@storm-software/config-tools/types";
4
3
  import { isFunction } from "@stryke/type-checks/is-function";
5
4
  import defu from "defu";
5
+ import { resolve } from "powerlines/lib/utilities/resolve";
6
6
  import StyleDictionary from "style-dictionary";
7
7
 
8
8
  //#region src/index.ts
@@ -0,0 +1,16 @@
1
+
2
+ //#region ../../node_modules/.pnpm/@storm-software+config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.js
3
+ var LogLevelLabel = {
4
+ SILENT: "silent",
5
+ FATAL: "fatal",
6
+ ERROR: "error",
7
+ WARN: "warn",
8
+ SUCCESS: "success",
9
+ INFO: "info",
10
+ DEBUG: "debug",
11
+ TRACE: "trace",
12
+ ALL: "all"
13
+ };
14
+
15
+ //#endregion
16
+ exports.LogLevelLabel = LogLevelLabel;
@@ -0,0 +1,15 @@
1
+ //#region ../../node_modules/.pnpm/@storm-software+config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.js
2
+ var LogLevelLabel = {
3
+ SILENT: "silent",
4
+ FATAL: "fatal",
5
+ ERROR: "error",
6
+ WARN: "warn",
7
+ SUCCESS: "success",
8
+ INFO: "info",
9
+ DEBUG: "debug",
10
+ TRACE: "trace",
11
+ ALL: "all"
12
+ };
13
+
14
+ //#endregion
15
+ export { LogLevelLabel };
@@ -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,9 +1,9 @@
1
- import { BuildOptions } from "esbuild";
2
1
  import { OutputOptions, RollupOptions } from "rollup";
3
2
  import { UserConfig } from "@farmfe/core";
4
3
  import { Configuration } from "@rspack/core";
5
- import { BuildOptions as BuildOptions$1 } from "@storm-software/tsup/types";
4
+ import { BuildOptions } from "@storm-software/tsup/types";
6
5
  import { UnbuildOptions } from "@storm-software/unbuild/types";
6
+ import { BuildOptions as BuildOptions$1 } from "esbuild";
7
7
  import { RolldownOptions } from "rolldown";
8
8
  import { UserConfig as UserConfig$1 } from "tsdown";
9
9
  import { DepOptimizationOptions, UserConfig as UserConfig$2 } from "vite";
@@ -153,8 +153,8 @@ interface BuildConfig {
153
153
  override?: Record<string, any>;
154
154
  }
155
155
  type BuildResolvedConfig = Omit<BuildConfig, "override">;
156
- type ESBuildBuildConfig = Omit<BuildOptions, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
157
- type ESBuildResolvedBuildConfig = Omit<BuildOptions, "inject"> & BuildResolvedConfig;
156
+ type ESBuildBuildConfig = Omit<BuildOptions$1, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
157
+ type ESBuildResolvedBuildConfig = Omit<BuildOptions$1, "inject"> & BuildResolvedConfig;
158
158
  type ViteBuildConfig = Omit<UserConfig$2, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
159
159
  /**
160
160
  * Optimize deps config
@@ -173,8 +173,8 @@ type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "o
173
173
  type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
174
174
  type RolldownBuildConfig = Omit<RolldownOptions, "input" | "external" | "tsconfig" | "logLevel" | "output"> & BuildConfig;
175
175
  type RolldownResolvedBuildConfig = RolldownOptions & BuildResolvedConfig;
176
- type TsupBuildConfig = Partial<Omit<BuildOptions$1, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
177
- type TsupResolvedBuildConfig = BuildOptions$1 & BuildResolvedConfig;
176
+ type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
177
+ type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
178
178
  type TsdownBuildConfig = Partial<Omit<UserConfig$1, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
179
179
  type TsdownResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
180
180
  type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
@@ -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
 
@@ -1,19 +1,19 @@
1
1
  import { BuildConfig, BuildResolvedConfig, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./build.mjs";
2
- import "./babel.mjs";
3
2
  import { StoragePort, StoragePreset } from "./fs.mjs";
4
3
  import { TSConfig } from "./tsconfig.mjs";
5
4
  import { PluginContext } from "./context.mjs";
6
5
  import { Plugin } from "./plugin.mjs";
7
- import { LogLevelLabel } from "@storm-software/config-tools/types";
8
6
  import { MaybePromise } from "@stryke/types/base";
9
7
  import { PreviewOptions } from "vite";
10
8
  import { Format } from "@storm-software/build-tools/types";
9
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
11
10
  import { StormWorkspaceConfig } from "@storm-software/config/types";
12
11
  import { TypeDefinitionParameter } from "@stryke/types/configuration";
13
12
  import { AssetGlob } from "@stryke/types/file";
14
13
  import { DateString } from "compatx";
15
14
 
16
15
  //#region ../powerlines/src/types/config.d.ts
16
+
17
17
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
18
18
  /**
19
19
  * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
@@ -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";
@@ -1,6 +1,6 @@
1
- import { EnvironmentConfig, UserConfig } from "../powerlines/src/types/config.mjs";
2
- import { ResolvedConfig } from "../powerlines/src/types/resolved.mjs";
3
- import { PluginContext } from "../powerlines/src/types/context.mjs";
1
+ import { EnvironmentConfig, UserConfig } from "../packages/powerlines/src/types/config.mjs";
2
+ import { ResolvedConfig } from "../packages/powerlines/src/types/resolved.mjs";
3
+ import { PluginContext } from "../packages/powerlines/src/types/context.mjs";
4
4
  import StyleDictionary, { Config } from "style-dictionary";
5
5
  import { TypeDefinitionParameter } from "@stryke/types/configuration";
6
6
  import { Action, FileHeader, Filter, Format, Parser, PlatformConfig, Preprocessor, Transform } from "style-dictionary/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-style-dictionary",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to generate project code with Style Dictionary.",
6
6
  "repository": {
@@ -127,14 +127,13 @@
127
127
  "@stryke/types": "^0.10.29",
128
128
  "defu": "^6.1.4",
129
129
  "jiti": "^2.6.1",
130
- "powerlines": "^0.37.2",
130
+ "powerlines": "^0.37.3",
131
131
  "style-dictionary": "^5.1.1"
132
132
  },
133
133
  "devDependencies": {
134
- "@powerlines/nx": "^0.11.58",
135
- "@powerlines/plugin-plugin": "^0.12.80",
134
+ "@powerlines/plugin-plugin": "^0.12.81",
136
135
  "@types/node": "^24.10.4"
137
136
  },
138
137
  "publishConfig": { "access": "public" },
139
- "gitHead": "5a9bfc9333eca98a453682f39a04a0d642930a50"
138
+ "gitHead": "ae9a5afaa497538477b63988242f433b60974623"
140
139
  }
@@ -1,102 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- require('../entry.cjs');
3
- let defu = require("defu");
4
- defu = require_rolldown_runtime.__toESM(defu);
5
- let __stryke_helpers_omit = require("@stryke/helpers/omit");
6
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
7
- require("@stryke/path/replace");
8
- let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
9
- require("@stryke/type-checks/is-string");
10
-
11
- //#region ../powerlines/src/lib/build/esbuild.ts
12
- const DEFAULT_ESBUILD_CONFIG = {
13
- target: "esnext",
14
- platform: "neutral",
15
- format: "esm",
16
- write: true,
17
- minify: true,
18
- sourcemap: false,
19
- bundle: true,
20
- treeShaking: true,
21
- keepNames: true,
22
- splitting: true,
23
- logLevel: "silent"
24
- };
25
- /**
26
- * Resolves the esbuild options.
27
- *
28
- * @param context - The build context.
29
- * @returns The resolved esbuild options.
30
- */
31
- function extractESBuildConfig(context) {
32
- const inject = context.config.build.override.inject ?? context.config.build.inject;
33
- if (inject && Object.keys(inject).length > 0) context.fs.writeSync((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
34
- if (value) if (Array.isArray(value)) {
35
- if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) {
36
- if (value.length === 1) return `
37
- import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
38
- export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
39
- else if (value.length > 1) return `
40
- import ${value[1] === "*" ? `* as ${(0, __stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, __stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
41
- export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
42
- } else if (value.length === 1) return `
43
- import ${key} from "${value[0]}";
44
- export { ${key} };`;
45
- else if (value.length > 1) return `
46
- import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
47
- export { ${key} };`;
48
- } else if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) return `
49
- import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
50
- export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
51
- else return `
52
- import ${key} from "${value}";
53
- export { ${key} };`;
54
- return "";
55
- }).join("\n"));
56
- return (0, defu.default)({
57
- alias: context.builtins.reduce((ret, id) => {
58
- if (!ret[id]) {
59
- const path = context.fs.ids[id];
60
- if (path) ret[id] = path;
61
- }
62
- return ret;
63
- }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
64
- if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
65
- return ret;
66
- }, {}) : context.config.build.alias : {}),
67
- inject: inject && Object.keys(inject).length > 0 ? [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
68
- }, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build.override, [
69
- "alias",
70
- "inject",
71
- "external",
72
- "noExternal",
73
- "skipNodeModulesBundle",
74
- "extensions"
75
- ]) : {}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build, [
76
- "alias",
77
- "inject",
78
- "external",
79
- "noExternal",
80
- "skipNodeModulesBundle",
81
- "extensions",
82
- "variant",
83
- "override"
84
- ]) : {}, {
85
- mainFields: context.config.build.mainFields,
86
- conditions: context.config.build.conditions,
87
- define: context.config.build.define,
88
- resolveExtensions: context.config.build.extensions,
89
- packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
90
- format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
91
- platform: context.config.build.platform,
92
- treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
93
- outdir: context.config.output.buildPath,
94
- tsconfig: context.tsconfig.tsconfigFilePath,
95
- minify: context.config.mode !== "development",
96
- metafile: context.config.mode === "development",
97
- sourcemap: context.config.mode === "development"
98
- }, DEFAULT_ESBUILD_CONFIG);
99
- }
100
-
101
- //#endregion
102
- exports.extractESBuildConfig = extractESBuildConfig;
@@ -1,100 +0,0 @@
1
- import "../entry.mjs";
2
- import defu from "defu";
3
- import { omit } from "@stryke/helpers/omit";
4
- import { joinPaths } from "@stryke/path/join-paths";
5
- import "@stryke/path/replace";
6
- import { camelCase } from "@stryke/string-format/camel-case";
7
- import "@stryke/type-checks/is-string";
8
-
9
- //#region ../powerlines/src/lib/build/esbuild.ts
10
- const DEFAULT_ESBUILD_CONFIG = {
11
- target: "esnext",
12
- platform: "neutral",
13
- format: "esm",
14
- write: true,
15
- minify: true,
16
- sourcemap: false,
17
- bundle: true,
18
- treeShaking: true,
19
- keepNames: true,
20
- splitting: true,
21
- logLevel: "silent"
22
- };
23
- /**
24
- * Resolves the esbuild options.
25
- *
26
- * @param context - The build context.
27
- * @returns The resolved esbuild options.
28
- */
29
- function extractESBuildConfig(context) {
30
- const inject = context.config.build.override.inject ?? context.config.build.inject;
31
- if (inject && Object.keys(inject).length > 0) context.fs.writeSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
32
- if (value) if (Array.isArray(value)) {
33
- if (camelCase(key) !== key) {
34
- if (value.length === 1) return `
35
- import ${camelCase(key)} from "${value[0]}";
36
- export { ${camelCase(key)} as "${key}" }`;
37
- else if (value.length > 1) return `
38
- import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
39
- export { ${camelCase(key)} as "${key}" }`;
40
- } else if (value.length === 1) return `
41
- import ${key} from "${value[0]}";
42
- export { ${key} };`;
43
- else if (value.length > 1) return `
44
- import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
45
- export { ${key} };`;
46
- } else if (camelCase(key) !== key) return `
47
- import ${camelCase(key)} from "${value[0]}";
48
- export { ${camelCase(key)} as "${key}" }`;
49
- else return `
50
- import ${key} from "${value}";
51
- export { ${key} };`;
52
- return "";
53
- }).join("\n"));
54
- return defu({
55
- alias: context.builtins.reduce((ret, id) => {
56
- if (!ret[id]) {
57
- const path = context.fs.ids[id];
58
- if (path) ret[id] = path;
59
- }
60
- return ret;
61
- }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
62
- if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
63
- return ret;
64
- }, {}) : context.config.build.alias : {}),
65
- inject: inject && Object.keys(inject).length > 0 ? [joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
66
- }, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
67
- "alias",
68
- "inject",
69
- "external",
70
- "noExternal",
71
- "skipNodeModulesBundle",
72
- "extensions"
73
- ]) : {}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
74
- "alias",
75
- "inject",
76
- "external",
77
- "noExternal",
78
- "skipNodeModulesBundle",
79
- "extensions",
80
- "variant",
81
- "override"
82
- ]) : {}, {
83
- mainFields: context.config.build.mainFields,
84
- conditions: context.config.build.conditions,
85
- define: context.config.build.define,
86
- resolveExtensions: context.config.build.extensions,
87
- packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
88
- format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
89
- platform: context.config.build.platform,
90
- treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
91
- outdir: context.config.output.buildPath,
92
- tsconfig: context.tsconfig.tsconfigFilePath,
93
- minify: context.config.mode !== "development",
94
- metafile: context.config.mode === "development",
95
- sourcemap: context.config.mode === "development"
96
- }, DEFAULT_ESBUILD_CONFIG);
97
- }
98
-
99
- //#endregion
100
- export { extractESBuildConfig };
@@ -1,12 +0,0 @@
1
- require('../plugin-utils/paths.cjs');
2
- let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
3
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
5
- require("@stryke/path/replace");
6
- require("@stryke/type-checks/is-string");
7
- require("@stryke/convert/to-array");
8
- require("@stryke/fs/is-file");
9
- require("@stryke/fs/list-files");
10
- require("@stryke/hash/murmurhash");
11
- require("@stryke/helpers/get-unique");
12
- require("@stryke/path/append");
@@ -1,14 +0,0 @@
1
- import "../plugin-utils/paths.mjs";
2
- import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
3
- import { isSetString } from "@stryke/type-checks/is-set-string";
4
- import { joinPaths } from "@stryke/path/join-paths";
5
- import "@stryke/path/replace";
6
- import "@stryke/type-checks/is-string";
7
- import "@stryke/convert/to-array";
8
- import "@stryke/fs/is-file";
9
- import "@stryke/fs/list-files";
10
- import "@stryke/hash/murmurhash";
11
- import "@stryke/helpers/get-unique";
12
- import "@stryke/path/append";
13
-
14
- export { };
@@ -1,35 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_esbuild = require('../build/esbuild.cjs');
3
- let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
- let esbuild = require("esbuild");
5
-
6
- //#region ../powerlines/src/lib/utilities/bundle.ts
7
- /**
8
- * Bundle a type definition to a module.
9
- *
10
- * @param context - The context object containing the environment paths.
11
- * @param file - The file path to bundle.
12
- * @param overrides - Optional overrides for the ESBuild configuration.
13
- * @returns A promise that resolves to the bundled module.
14
- */
15
- async function bundle(context, file, overrides = {}) {
16
- const path = await context.fs.resolve(file);
17
- if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
18
- const result = await (0, esbuild.build)({
19
- ...require_esbuild.extractESBuildConfig(context),
20
- entryPoints: [path],
21
- write: false,
22
- sourcemap: false,
23
- splitting: false,
24
- treeShaking: false,
25
- bundle: true,
26
- ...overrides
27
- });
28
- if (result.errors.length > 0) throw new Error(`Failed to transpile ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
29
- if (result.warnings.length > 0) context.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `Warnings while transpiling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
30
- if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
31
- return result.outputFiles.filter(Boolean)[0];
32
- }
33
-
34
- //#endregion
35
- exports.bundle = bundle;
@@ -1,34 +0,0 @@
1
- import { extractESBuildConfig } from "../build/esbuild.mjs";
2
- import { LogLevelLabel } from "@storm-software/config-tools/types";
3
- import { build } from "esbuild";
4
-
5
- //#region ../powerlines/src/lib/utilities/bundle.ts
6
- /**
7
- * Bundle a type definition to a module.
8
- *
9
- * @param context - The context object containing the environment paths.
10
- * @param file - The file path to bundle.
11
- * @param overrides - Optional overrides for the ESBuild configuration.
12
- * @returns A promise that resolves to the bundled module.
13
- */
14
- async function bundle(context, file, overrides = {}) {
15
- const path = await context.fs.resolve(file);
16
- if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
17
- const result = await build({
18
- ...extractESBuildConfig(context),
19
- entryPoints: [path],
20
- write: false,
21
- sourcemap: false,
22
- splitting: false,
23
- treeShaking: false,
24
- bundle: true,
25
- ...overrides
26
- });
27
- if (result.errors.length > 0) throw new Error(`Failed to transpile ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
28
- if (result.warnings.length > 0) context.log(LogLevelLabel.WARN, `Warnings while transpiling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
29
- if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
30
- return result.outputFiles.filter(Boolean)[0];
31
- }
32
-
33
- //#endregion
34
- export { bundle };
@@ -1,30 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_bundle = require('./bundle.cjs');
3
- let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
4
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
-
6
- //#region ../powerlines/src/lib/utilities/resolve.ts
7
- /**
8
- * Compiles a type definition to a module.
9
- *
10
- * @param context - The context object containing the environment paths.
11
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
12
- * @param overrides - Optional overrides for the ESBuild configuration.
13
- * @returns A promise that resolves to the compiled module.
14
- */
15
- async function resolve(context, type, overrides = {}) {
16
- let typeDefinition;
17
- if ((0, __stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(type);
18
- else typeDefinition = type;
19
- const result = await require_bundle.bundle(context, typeDefinition.file, overrides);
20
- const resolved = await context.resolver.evalModule(result.text, {
21
- filename: result.path,
22
- forceTranspile: true
23
- });
24
- let exportName = typeDefinition.name;
25
- if (!exportName) exportName = "default";
26
- return resolved[exportName] ?? resolved[`__Ω${exportName}`];
27
- }
28
-
29
- //#endregion
30
- exports.resolve = resolve;
@@ -1,29 +0,0 @@
1
- import { bundle } from "./bundle.mjs";
2
- import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
3
- import { isSetString } from "@stryke/type-checks/is-set-string";
4
-
5
- //#region ../powerlines/src/lib/utilities/resolve.ts
6
- /**
7
- * Compiles a type definition to a module.
8
- *
9
- * @param context - The context object containing the environment paths.
10
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
11
- * @param overrides - Optional overrides for the ESBuild configuration.
12
- * @returns A promise that resolves to the compiled module.
13
- */
14
- async function resolve(context, type, overrides = {}) {
15
- let typeDefinition;
16
- if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
17
- else typeDefinition = type;
18
- const result = await bundle(context, typeDefinition.file, overrides);
19
- const resolved = await context.resolver.evalModule(result.text, {
20
- filename: result.path,
21
- forceTranspile: true
22
- });
23
- let exportName = typeDefinition.name;
24
- if (!exportName) exportName = "default";
25
- return resolved[exportName] ?? resolved[`__Ω${exportName}`];
26
- }
27
-
28
- //#endregion
29
- export { resolve };
@@ -1 +0,0 @@
1
- require("@stryke/path/replace");
@@ -1,3 +0,0 @@
1
- import "@stryke/path/replace";
2
-
3
- export { };
@@ -1,2 +0,0 @@
1
- import "./config.mjs";
2
- import "./context.mjs";