@powerlines/plugin-react 0.1.122 → 0.1.123

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 (100) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/components/index.cjs +3 -1
  4. package/dist/components/index.mjs +3 -1
  5. package/dist/components/react-optimized.cjs +45 -1
  6. package/dist/components/react-optimized.mjs +43 -1
  7. package/dist/deepkit/schemas/reflection.cjs +3940 -1
  8. package/dist/deepkit/schemas/reflection.mjs +3938 -1
  9. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  10. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  11. package/dist/deepkit/src/capnp.cjs +913 -1
  12. package/dist/deepkit/src/capnp.mjs +911 -1
  13. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  14. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  15. package/dist/deepkit/src/reflect-type.cjs +22 -1
  16. package/dist/deepkit/src/reflect-type.mjs +20 -1
  17. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  18. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  19. package/dist/deepkit/src/transformer.cjs +52 -1
  20. package/dist/deepkit/src/transformer.mjs +49 -1
  21. package/dist/deepkit/src/transpile.cjs +29 -1
  22. package/dist/deepkit/src/transpile.mjs +27 -1
  23. package/dist/deepkit/src/utilities.cjs +66 -1
  24. package/dist/deepkit/src/utilities.mjs +65 -1
  25. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  26. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  27. package/dist/deepkit/src/vendor/type.cjs +20 -1
  28. package/dist/deepkit/src/vendor/type.mjs +11 -1
  29. package/dist/index.cjs +104 -1
  30. package/dist/index.mjs +98 -1
  31. package/dist/plugin-alloy/src/core/components/output.cjs +45 -1
  32. package/dist/plugin-alloy/src/core/components/output.mjs +44 -1
  33. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  34. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  35. package/dist/plugin-alloy/src/index.cjs +93 -1
  36. package/dist/plugin-alloy/src/index.mjs +91 -1
  37. package/dist/plugin-automd/src/index.cjs +101 -1
  38. package/dist/plugin-automd/src/index.mjs +98 -1
  39. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  40. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  41. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  42. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  43. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  44. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  45. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  46. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  47. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  48. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  49. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  50. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  51. package/dist/plugin-babel/src/index.cjs +91 -1
  52. package/dist/plugin-babel/src/index.mjs +89 -1
  53. package/dist/plugin-env/src/babel/index.cjs +1 -1
  54. package/dist/plugin-env/src/babel/index.mjs +3 -1
  55. package/dist/plugin-env/src/babel/plugin.cjs +120 -4
  56. package/dist/plugin-env/src/babel/plugin.mjs +118 -4
  57. package/dist/plugin-env/src/components/docs.cjs +9 -1
  58. package/dist/plugin-env/src/components/docs.mjs +11 -1
  59. package/dist/plugin-env/src/components/env.cjs +432 -11
  60. package/dist/plugin-env/src/components/env.mjs +430 -9
  61. package/dist/plugin-env/src/components/index.cjs +2 -1
  62. package/dist/plugin-env/src/components/index.mjs +4 -1
  63. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -1
  64. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -1
  65. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -1
  66. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -1
  67. package/dist/plugin-env/src/helpers/index.cjs +6 -1
  68. package/dist/plugin-env/src/helpers/index.mjs +8 -1
  69. package/dist/plugin-env/src/helpers/load.cjs +83 -1
  70. package/dist/plugin-env/src/helpers/load.mjs +80 -1
  71. package/dist/plugin-env/src/helpers/persistence.cjs +200 -1
  72. package/dist/plugin-env/src/helpers/persistence.mjs +189 -1
  73. package/dist/plugin-env/src/helpers/reflect.cjs +111 -1
  74. package/dist/plugin-env/src/helpers/reflect.mjs +103 -1
  75. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -1
  76. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -1
  77. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -1
  78. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -1
  79. package/dist/plugin-env/src/index.cjs +170 -5
  80. package/dist/plugin-env/src/index.mjs +168 -5
  81. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  82. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  83. package/dist/powerlines/src/lib/entry.cjs +12 -1
  84. package/dist/powerlines/src/lib/entry.mjs +14 -1
  85. package/dist/powerlines/src/lib/logger.cjs +41 -1
  86. package/dist/powerlines/src/lib/logger.mjs +39 -1
  87. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +38 -1
  88. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +35 -1
  89. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  90. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  91. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  92. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  93. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  94. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  95. package/dist/powerlines/src/types/context.d.cts +27 -3
  96. package/dist/powerlines/src/types/context.d.mts +27 -3
  97. package/dist/types/index.mjs +1 -1
  98. package/dist/types/plugin.mjs +1 -1
  99. package/dist/types/runtime.mjs +1 -1
  100. package/package.json +10 -10
@@ -1,10 +1,173 @@
1
- import{type_exports as e}from"../../deepkit/src/vendor/type.mjs";import t from"../../plugin-babel/src/index.mjs";import n from"../../plugin-alloy/src/index.mjs";import r from"../../plugin-automd/src/index.mjs";import{BaseEnv as i,BaseSecrets as a,createEnvReflection as o,createSecretsReflection as s,mergeEnvReflections as c,mergeSecretsReflections as l,reflectEnv as u,reflectSecrets as d}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as f,getEnvReflectionsPath as p,getEnvTypeReflectionsPath as m,getSecretsDefaultTypeDefinition as h,readEnvReflection as g,readEnvTypeReflection as _,readSecretsReflection as v,resolveRuntimeTypeFile as y,writeEnvReflection as b,writeEnvTypeReflection as x}from"./helpers/persistence.mjs";import{envBabelPlugin as S}from"./babel/plugin.mjs";import{removeEnvPrefix as C}from"./helpers/source-file-env.mjs";import{loadEnv as w,loadEnvFromContext as T}from"./helpers/load.mjs";import{createReflectionResource as E}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as D,EnvTypeDefinition as O}from"./components/env.mjs";import{env as k}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import"./components/index.mjs";import"./helpers/index.mjs";import{createComponent as A}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as j}from"@storm-software/config-tools/types";import{isParentPath as M}from"@stryke/path/is-parent-path";import N from"defu";import{titleCase as P}from"@stryke/string-format/title-case";import{toArray as F}from"@stryke/convert/to-array";import{parseTypeDefinition as I}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as L}from"@stryke/env/types";import{existsSync as R}from"@stryke/fs/exists";import{createDirectory as z}from"@stryke/fs/helpers";import{joinPaths as B}from"@stryke/path/join";import{constantCase as V}from"@stryke/string-format/constant-case";var H=(i={})=>[n(i.alloy),t(i.babel),{name:`env`,async config(){this.log(j.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:N(i,{types:{},prefix:[]}),transform:{babel:{plugins:[S]}}};if(e.env.types)e.env.types=I(e.env.types);else{this.log(j.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await f(this);e.env.types=I(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=I(e.env.secrets);else{let t=await h(this);e.env.secrets=I(`${t.file}#${t.name}`)}return e.env.prefix=F(e.env.prefix??[]).reduce((e,t)=>{let n=V(t);return e.includes(n)||e.push(n),e},[...L,`POWERLINES_`]),e.env.prefix=e.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),e},async configResolved(){if(this.log(j.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=N({parsed:await w(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&R(m(this,`env`)))this.log(j.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await _(this,`env`),R(p(this,`env`))&&(this.env.used.env=await g(this)),R(m(this,`secrets`))&&(this.env.types.secrets=await _(this,`secrets`)),R(p(this,`secrets`))&&(this.env.used.secrets=await v(this));else{if(this.env.types.env=await u(this,this.config.env.types?.file?M(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:B(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await x(this,this.env.types.env,`env`),this.env.types.secrets=await d(this,this.config.env.secrets?.file?M(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:B(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await x(this,this.env.types.secrets,`secrets`),this.log(j.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await w(this,this.config.env)).forEach(([e,n])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=t.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await b(this,this.env.used.env,`env`),this.env.types.secrets&&(await x(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await b(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(j.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(A(D,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(j.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=B(this.config.projectRoot,`docs`,`generated`);R(t)||await z(t);let n=await _(this,`env`),r=B(t,`env.md`);this.log(j.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${P(this.config.framework)||`Powerlines`} -->
1
+ import { type_exports } from "../../deepkit/src/vendor/type.mjs";
2
+ import src_default$2 from "../../plugin-babel/src/index.mjs";
3
+ import src_default from "../../plugin-alloy/src/index.mjs";
4
+ import src_default$1 from "../../plugin-automd/src/index.mjs";
5
+ import { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./helpers/reflect.mjs";
6
+ import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvTypeReflection } from "./helpers/persistence.mjs";
7
+ import { envBabelPlugin } from "./babel/plugin.mjs";
8
+ import { removeEnvPrefix } from "./helpers/source-file-env.mjs";
9
+ import { loadEnv, loadEnvFromContext } from "./helpers/load.mjs";
10
+ import { createReflectionResource } from "./helpers/create-reflection-resource.mjs";
11
+ import { EnvBuiltin, EnvTypeDefinition } from "./components/env.mjs";
12
+ import { env } from "./helpers/automd-generator.mjs";
13
+ import "./babel/index.mjs";
14
+ import "./components/index.mjs";
15
+ import "./helpers/index.mjs";
16
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
17
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
18
+ import { isParentPath } from "@stryke/path/is-parent-path";
19
+ import defu from "defu";
20
+ import { titleCase } from "@stryke/string-format/title-case";
21
+ import { toArray } from "@stryke/convert/to-array";
22
+ import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
23
+ import { ENV_PREFIXES } from "@stryke/env/types";
24
+ import { existsSync } from "@stryke/fs/exists";
25
+ import { createDirectory } from "@stryke/fs/helpers";
26
+ import { joinPaths } from "@stryke/path/join";
27
+ import { constantCase } from "@stryke/string-format/constant-case";
28
+
29
+ //#region ../plugin-env/src/index.tsx
30
+ /**
31
+ * A Powerlines plugin to inject environment variables into the source code.
32
+ */
33
+ const plugin = (options = {}) => {
34
+ return [
35
+ src_default(options.alloy),
36
+ src_default$2(options.babel),
37
+ {
38
+ name: "env",
39
+ async config() {
40
+ this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `env` build plugin.");
41
+ const config = {
42
+ env: defu(options, {
43
+ types: {},
44
+ prefix: []
45
+ }),
46
+ transform: { babel: { plugins: [envBabelPlugin] } }
47
+ };
48
+ if (config.env.types) config.env.types = parseTypeDefinition(config.env.types);
49
+ else {
50
+ this.log(LogLevelLabel.WARN, "The `env.types` configuration parameter was not provided. Please ensure this is expected.");
51
+ const envDefaultTypeDefinition = await getEnvDefaultTypeDefinition(this);
52
+ config.env.types = parseTypeDefinition(`${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`);
53
+ }
54
+ if (config.env.secrets) config.env.secrets = parseTypeDefinition(config.env.secrets);
55
+ else {
56
+ const secretsDefaultTypeDefinition = await getSecretsDefaultTypeDefinition(this);
57
+ config.env.secrets = parseTypeDefinition(`${secretsDefaultTypeDefinition.file}#${secretsDefaultTypeDefinition.name}`);
58
+ }
59
+ config.env.prefix = toArray(config.env.prefix ?? []).reduce((ret, prefix) => {
60
+ const formattedPrefix = constantCase(prefix);
61
+ if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
62
+ return ret;
63
+ }, [...ENV_PREFIXES, "POWERLINES_"]);
64
+ config.env.prefix = config.env.prefix.reduce((ret, prefix) => {
65
+ if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
66
+ return ret;
67
+ }, []);
68
+ return config;
69
+ },
70
+ async configResolved() {
71
+ this.log(LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
72
+ this.config.env.inject ??= this.config.projectType === "application";
73
+ this.env = defu({ parsed: await loadEnv(this, this.config.env) }, this.env ?? {}, {
74
+ types: { env: {} },
75
+ used: {
76
+ env: {},
77
+ secrets: {}
78
+ },
79
+ parsed: {},
80
+ injected: {}
81
+ });
82
+ if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && existsSync(getEnvTypeReflectionsPath(this, "env"))) {
83
+ this.log(LogLevelLabel.TRACE, `Skipping reflection initialization as the meta checksum has not changed.`);
84
+ this.env.types.env = await readEnvTypeReflection(this, "env");
85
+ if (existsSync(getEnvReflectionsPath(this, "env"))) this.env.used.env = await readEnvReflection(this);
86
+ if (existsSync(getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await readEnvTypeReflection(this, "secrets");
87
+ if (existsSync(getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await readSecretsReflection(this);
88
+ } else {
89
+ this.env.types.env = await reflectEnv(this, this.config.env.types?.file ? isParentPath(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : joinPaths(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
90
+ if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
91
+ await writeEnvTypeReflection(this, this.env.types.env, "env");
92
+ this.env.types.secrets = await reflectSecrets(this, this.config.env.secrets?.file ? isParentPath(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : joinPaths(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
93
+ if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
94
+ await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
95
+ this.log(LogLevelLabel.TRACE, `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`);
96
+ const envWithAlias = this.env.types.env.getProperties().filter((prop) => prop.getAlias().length > 0);
97
+ Object.entries(await loadEnv(this, this.config.env)).forEach(([key, value]) => {
98
+ const unprefixedKey = this.config.env.prefix.reduce((ret, prefix) => {
99
+ if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
100
+ return ret;
101
+ }, key);
102
+ const aliasKey = envWithAlias.find((prop) => prop?.getAlias().reverse().includes(unprefixedKey));
103
+ if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
104
+ });
105
+ this.env.used.env = new type_exports.ReflectionClass({
106
+ kind: type_exports.ReflectionKind.objectLiteral,
107
+ typeName: "Env",
108
+ description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
109
+ types: []
110
+ }, this.env.types.env);
111
+ await writeEnvReflection(this, this.env.used.env, "env");
112
+ if (this.env.types.secrets) {
113
+ await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
114
+ this.env.used.secrets = new type_exports.ReflectionClass({
115
+ kind: type_exports.ReflectionKind.objectLiteral,
116
+ typeName: "Secrets",
117
+ description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
118
+ types: []
119
+ }, this.env.types.secrets);
120
+ await writeEnvReflection(this, this.env.used.secrets, "secrets");
121
+ }
122
+ }
123
+ },
124
+ async prepare() {
125
+ const _self$ = this;
126
+ this.log(LogLevelLabel.TRACE, `Preparing the Environment runtime artifacts for the Powerlines project.`);
127
+ return this.render(createComponent(EnvBuiltin, { get defaultConfig() {
128
+ return _self$.config.env.defaultConfig;
129
+ } }));
130
+ },
131
+ async docs() {
132
+ this.log(LogLevelLabel.TRACE, "Writing Environment documentation for the Powerlines project artifacts.");
133
+ const outputPath = joinPaths(this.config.projectRoot, "docs", "generated");
134
+ if (!existsSync(outputPath)) await createDirectory(outputPath);
135
+ const reflection = await readEnvTypeReflection(this, "env");
136
+ const envDocFile = joinPaths(outputPath, "env.md");
137
+ this.log(LogLevelLabel.TRACE, `Documenting environment variables configuration in "${envDocFile}"`);
138
+ await this.fs.write(envDocFile, `<!-- Generated by ${titleCase(this.config.framework) || "Powerlines"} -->
2
139
 
3
140
  Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project. The variables in the list below are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
4
141
 
5
142
  | Name | Description | Type | Default Value | Required |
6
143
  | ---- | ----------- | ---- | ------------- | :------: |
7
- ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
8
- `,``)??``).trim()} | ${(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `)} | ${t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``} | ${t.isValueRequired()?``:`✔`} |`).join(`
9
- `)}
10
- `)},async buildEnd(){let e=p(this,`env`);this.log(j.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:N(i.automd??{},{generators:{env:k(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},r(i.automd)];export{H as default};
144
+ ${reflection.getProperties().filter((property) => property.getNameAsString() !== "__POWERLINES_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
145
+ return `| ${reflectionProperty.getNameAsString().trim()} | ${(reflectionProperty.getDescription()?.replaceAll("\r", "")?.replaceAll("\n", "") ?? "").trim()} | ${(0, type_exports.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or ")} | ${reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : ""} | ${reflectionProperty.isValueRequired() ? "" : "✔"} |`;
146
+ }).join("\n")}
147
+ `);
148
+ },
149
+ async buildEnd() {
150
+ const reflectionPath = getEnvReflectionsPath(this, "env");
151
+ this.log(LogLevelLabel.TRACE, `Writing env reflection types to ${reflectionPath}.`);
152
+ await writeEnvReflection(this, this.env.used.env, "env");
153
+ }
154
+ },
155
+ {
156
+ name: "env:automd-generator",
157
+ config() {
158
+ return { automd: defu(options.automd ?? {}, { generators: { "env": env(this) } }) };
159
+ }
160
+ },
161
+ {
162
+ name: "env:vite",
163
+ vite: { configResolved() {
164
+ return { envPrefix: this.config?.env?.prefix };
165
+ } }
166
+ },
167
+ src_default$1(options.automd)
168
+ ];
169
+ };
170
+ var src_default$3 = plugin;
171
+
172
+ //#endregion
173
+ export { src_default$3 as default };
@@ -1,14 +1,102 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);require(`../entry.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/type-checks/is-string`),r=require(`@stryke/path/replace`),i=require(`@stryke/path/join-paths`),a=require(`@stryke/helpers/omit`),o=require(`@stryke/string-format/camel-case`);const s={target:`esnext`,platform:`neutral`,format:`esm`,write:!0,minify:!0,sourcemap:!1,bundle:!0,treeShaking:!0,keepNames:!0,splitting:!0,logLevel:`silent`};function c(e){let n=e.config.build.override.inject??e.config.build.inject;return n&&Object.keys(n).length>0&&e.fs.writeSync((0,i.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`),Object.entries(n).map(([e,t])=>{if(t)if(Array.isArray(t)){if((0,o.camelCase)(e)!==e){if(t.length===1)return`
2
- import ${(0,o.camelCase)(e)} from "${t[0]}";
3
- export { ${(0,o.camelCase)(e)} as "${e}" }`;if(t.length>1)return`
4
- import ${t[1]===`*`?`* as ${(0,o.camelCase)(e)}`:`{ ${t[1]} as ${(0,o.camelCase)(e)} }`} from "${t[0]}";
5
- export { ${(0,o.camelCase)(e)} as "${e}" }`}else if(t.length===1)return`
6
- import ${e} from "${t[0]}";
7
- export { ${e} };`;else if(t.length>1)return`
8
- import ${t[1]===`*`?`* as ${e}`:`{ ${t[1]} as ${e} }`} from "${t[0]}";
9
- export { ${e} };`}else if((0,o.camelCase)(e)!==e)return`
10
- import ${(0,o.camelCase)(e)} from "${t[0]}";
11
- export { ${(0,o.camelCase)(e)} as "${e}" }`;else return`
12
- import ${e} from "${t}";
13
- export { ${e} };`;return``}).join(`
14
- `)),(0,t.default)({alias:e.builtins.reduce((t,n)=>{if(!t[n]){let r=e.fs.ids[n];r&&(t[n]=r)}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias.reduce((e,t)=>(e[t.find.toString()]||(e[t.find.toString()]=t.replacement),e),{}):e.config.build.alias:{}),inject:n&&Object.keys(n).length>0?[(0,i.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`)]:void 0},e.config.build.variant===`esbuild`?(0,a.omit)(e.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},e.config.build.variant===`esbuild`?(0,a.omit)(e.config.build,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`,`variant`,`override`]):{},{mainFields:e.config.build.mainFields,conditions:e.config.build.conditions,define:e.config.build.define,resolveExtensions:e.config.build.extensions,packages:e.config.build.skipNodeModulesBundle?`external`:e.config.build.variant===`esbuild`?e.config.build.packages:void 0,format:Array.isArray(e.config.output.format)?e.config.output.format[0]:e.config.output.format,platform:e.config.build.platform,treeShaking:!!e.config.build?.treeshake||e.config.build?.treeShaking,outdir:e.config.output.buildPath,tsconfig:e.tsconfig.tsconfigFilePath,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`},s)}exports.extractESBuildConfig=c;
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_type_checks_is_string = require("@stryke/type-checks/is-string");
6
+ let __stryke_path_replace = require("@stryke/path/replace");
7
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
8
+ let __stryke_helpers_omit = require("@stryke/helpers/omit");
9
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
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,14 +1,100 @@
1
- import"../entry.mjs";import e from"defu";import{isString as t}from"@stryke/type-checks/is-string";import{replacePath as n}from"@stryke/path/replace";import{joinPaths as r}from"@stryke/path/join-paths";import{omit as i}from"@stryke/helpers/omit";import{camelCase as a}from"@stryke/string-format/camel-case";const o={target:`esnext`,platform:`neutral`,format:`esm`,write:!0,minify:!0,sourcemap:!1,bundle:!0,treeShaking:!0,keepNames:!0,splitting:!0,logLevel:`silent`};function s(t){let n=t.config.build.override.inject??t.config.build.inject;return n&&Object.keys(n).length>0&&t.fs.writeSync(r(t.workspaceConfig.workspaceRoot,t.config.projectRoot,t.artifactsPath,`inject-shim.js`),Object.entries(n).map(([e,t])=>{if(t)if(Array.isArray(t)){if(a(e)!==e){if(t.length===1)return`
2
- import ${a(e)} from "${t[0]}";
3
- export { ${a(e)} as "${e}" }`;if(t.length>1)return`
4
- import ${t[1]===`*`?`* as ${a(e)}`:`{ ${t[1]} as ${a(e)} }`} from "${t[0]}";
5
- export { ${a(e)} as "${e}" }`}else if(t.length===1)return`
6
- import ${e} from "${t[0]}";
7
- export { ${e} };`;else if(t.length>1)return`
8
- import ${t[1]===`*`?`* as ${e}`:`{ ${t[1]} as ${e} }`} from "${t[0]}";
9
- export { ${e} };`}else if(a(e)!==e)return`
10
- import ${a(e)} from "${t[0]}";
11
- export { ${a(e)} as "${e}" }`;else return`
12
- import ${e} from "${t}";
13
- export { ${e} };`;return``}).join(`
14
- `)),e({alias:t.builtins.reduce((e,n)=>{if(!e[n]){let r=t.fs.ids[n];r&&(e[n]=r)}return e},t.config.build.alias?Array.isArray(t.config.build.alias)?t.config.build.alias.reduce((e,t)=>(e[t.find.toString()]||(e[t.find.toString()]=t.replacement),e),{}):t.config.build.alias:{}),inject:n&&Object.keys(n).length>0?[r(t.workspaceConfig.workspaceRoot,t.config.projectRoot,t.artifactsPath,`inject-shim.js`)]:void 0},t.config.build.variant===`esbuild`?i(t.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},t.config.build.variant===`esbuild`?i(t.config.build,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`,`variant`,`override`]):{},{mainFields:t.config.build.mainFields,conditions:t.config.build.conditions,define:t.config.build.define,resolveExtensions:t.config.build.extensions,packages:t.config.build.skipNodeModulesBundle?`external`:t.config.build.variant===`esbuild`?t.config.build.packages:void 0,format:Array.isArray(t.config.output.format)?t.config.output.format[0]:t.config.output.format,platform:t.config.build.platform,treeShaking:!!t.config.build?.treeshake||t.config.build?.treeShaking,outdir:t.config.output.buildPath,tsconfig:t.tsconfig.tsconfigFilePath,minify:t.config.mode!==`development`,metafile:t.config.mode===`development`,sourcemap:t.config.mode===`development`},o)}export{s as extractESBuildConfig};
1
+ import "../entry.mjs";
2
+ import defu from "defu";
3
+ import { isString } from "@stryke/type-checks/is-string";
4
+ import { replacePath } from "@stryke/path/replace";
5
+ import { joinPaths } from "@stryke/path/join-paths";
6
+ import { omit } from "@stryke/helpers/omit";
7
+ import { camelCase } from "@stryke/string-format/camel-case";
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 +1,12 @@
1
- require(`../plugin-utils/paths.cjs`);let e=require(`@stryke/type-checks/is-set-string`),t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/path/replace`),r=require(`@stryke/convert/to-array`),i=require(`@stryke/fs/is-file`),a=require(`@stryke/fs/list-files`),o=require(`@stryke/path/append`),s=require(`@stryke/path/join-paths`),c=require(`@stryke/convert/parse-type-definition`),l=require(`@stryke/helpers/get-unique`);require(`@stryke/hash/murmurhash`);
1
+ require('../plugin-utils/paths.cjs');
2
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
3
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
4
+ let __stryke_path_replace = require("@stryke/path/replace");
5
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
6
+ let __stryke_fs_is_file = require("@stryke/fs/is-file");
7
+ let __stryke_fs_list_files = require("@stryke/fs/list-files");
8
+ let __stryke_path_append = require("@stryke/path/append");
9
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
10
+ let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
11
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
12
+ require("@stryke/hash/murmurhash");
@@ -1 +1,14 @@
1
- import"../plugin-utils/paths.mjs";import{isSetString as e}from"@stryke/type-checks/is-set-string";import{isString as t}from"@stryke/type-checks/is-string";import{replacePath as n}from"@stryke/path/replace";import{toArray as r}from"@stryke/convert/to-array";import"@stryke/fs/is-file";import{listFiles as i}from"@stryke/fs/list-files";import{appendPath as a}from"@stryke/path/append";import{joinPaths as o}from"@stryke/path/join-paths";import{parseTypeDefinition as s}from"@stryke/convert/parse-type-definition";import{getUniqueBy as c}from"@stryke/helpers/get-unique";import"@stryke/hash/murmurhash";export{};
1
+ import "../plugin-utils/paths.mjs";
2
+ import { isSetString } from "@stryke/type-checks/is-set-string";
3
+ import { isString } from "@stryke/type-checks/is-string";
4
+ import { replacePath } from "@stryke/path/replace";
5
+ import { toArray } from "@stryke/convert/to-array";
6
+ import "@stryke/fs/is-file";
7
+ import { listFiles } from "@stryke/fs/list-files";
8
+ import { appendPath } from "@stryke/path/append";
9
+ import { joinPaths } from "@stryke/path/join-paths";
10
+ import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
11
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
12
+ import "@stryke/hash/murmurhash";
13
+
14
+ export { };
@@ -1 +1,41 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`chalk`);n=e.__toESM(n),require(`@storm-software/config-tools/logger`),require(`@storm-software/config-tools/utilities/colors`),require(`@stryke/helpers/noop`);let r=require(`@stryke/string-format/kebab-case`),i=require(`@stryke/string-format/title-case`);const a=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],o=(e,t)=>(r,...o)=>e(r,` ${n.default.inverse.hex(a[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%a.length]||a[0])(` ${(0,i.titleCase)(t)} `)} ${o.join(` `)} `);exports.extendLog=o;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
3
+ let chalk = require("chalk");
4
+ chalk = require_rolldown_runtime.__toESM(chalk);
5
+ require("@storm-software/config-tools/logger");
6
+ require("@storm-software/config-tools/utilities/colors");
7
+ require("@stryke/helpers/noop");
8
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
9
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
10
+
11
+ //#region ../powerlines/src/lib/logger.ts
12
+ const BADGE_COLORS = [
13
+ "#00A0DD",
14
+ "#6FCE4E",
15
+ "#FBBF24",
16
+ "#F43F5E",
17
+ "#3B82F6",
18
+ "#A855F7",
19
+ "#469592",
20
+ "#288EDF",
21
+ "#D8B4FE",
22
+ "#10B981",
23
+ "#EF4444",
24
+ "#F0EC56",
25
+ "#F472B6",
26
+ "#22D3EE",
27
+ "#EAB308",
28
+ "#84CC16",
29
+ "#F87171",
30
+ "#0EA5E9",
31
+ "#D946EF",
32
+ "#FACC15",
33
+ "#34D399",
34
+ "#8B5CF6"
35
+ ];
36
+ const extendLog = (logFn, name) => {
37
+ 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(" ")} `);
38
+ };
39
+
40
+ //#endregion
41
+ exports.extendLog = extendLog;
@@ -1 +1,39 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import t from"chalk";import"@storm-software/config-tools/logger";import"@storm-software/config-tools/utilities/colors";import"@stryke/helpers/noop";import{kebabCase as n}from"@stryke/string-format/kebab-case";import{titleCase as r}from"@stryke/string-format/title-case";const i=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],a=(e,n)=>(a,...o)=>e(a,` ${t.inverse.hex(i[n.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%i.length]||i[0])(` ${r(n)} `)} ${o.join(` `)} `);export{a as extendLog};
1
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
2
+ import chalk from "chalk";
3
+ import "@storm-software/config-tools/logger";
4
+ import "@storm-software/config-tools/utilities/colors";
5
+ import "@stryke/helpers/noop";
6
+ import { kebabCase } from "@stryke/string-format/kebab-case";
7
+ import { titleCase } from "@stryke/string-format/title-case";
8
+
9
+ //#region ../powerlines/src/lib/logger.ts
10
+ const BADGE_COLORS = [
11
+ "#00A0DD",
12
+ "#6FCE4E",
13
+ "#FBBF24",
14
+ "#F43F5E",
15
+ "#3B82F6",
16
+ "#A855F7",
17
+ "#469592",
18
+ "#288EDF",
19
+ "#D8B4FE",
20
+ "#10B981",
21
+ "#EF4444",
22
+ "#F0EC56",
23
+ "#F472B6",
24
+ "#22D3EE",
25
+ "#EAB308",
26
+ "#84CC16",
27
+ "#F87171",
28
+ "#0EA5E9",
29
+ "#D946EF",
30
+ "#FACC15",
31
+ "#34D399",
32
+ "#8B5CF6"
33
+ ];
34
+ const extendLog = (logFn, name) => {
35
+ return (type, ...args) => logFn(type, ` ${chalk.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
36
+ };
37
+
38
+ //#endregion
39
+ export { extendLog };
@@ -1 +1,38 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/path/append`),r=require(`@stryke/path/join-paths`),i=require(`@stryke/fs/exists`),a=require(`typescript`);a=e.__toESM(a),require(`@stryke/fs/json`);function o(e,t,n=[`.ts`,`.tsx`,`.d.ts`]){return t.find(t=>e?.toString().toLowerCase()===t?.toString().toLowerCase()||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}`||`./${e?.toString().toLowerCase()}`===t?.toString().toLowerCase()||n.some(n=>`${e?.toString().toLowerCase()}${n}`===t?.toString().toLowerCase()||`${e?.toString().toLowerCase()}${n}`==`./${t?.toString().toLowerCase()}`||`${t?.toString().toLowerCase()}${n}`==`./${e?.toString().toLowerCase()}`||e?.toString().toLowerCase()===`${t?.toString().toLowerCase()}${n}`||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}${n}`||t?.toString().toLowerCase()===`./${e?.toString().toLowerCase()}${n}`))}function s(e,t){return o(e,t)!==void 0}exports.isMatchFound=s;
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ let defu = require("defu");
3
+ defu = require_rolldown_runtime.__toESM(defu);
4
+ let __stryke_path_append = require("@stryke/path/append");
5
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
6
+ let __stryke_fs_exists = require("@stryke/fs/exists");
7
+ let typescript = require("typescript");
8
+ typescript = require_rolldown_runtime.__toESM(typescript);
9
+ require("@stryke/fs/json");
10
+
11
+ //#region ../powerlines/src/lib/typescript/tsconfig.ts
12
+ /**
13
+ * Check if the TypeScript configuration type matches any of the provided types.
14
+ *
15
+ * @param tsconfigType - The type from the TypeScript configuration.
16
+ * @param types - An array of type names to check against.
17
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
18
+ */
19
+ function findMatch(tsconfigType, types, extensions = [
20
+ ".ts",
21
+ ".tsx",
22
+ ".d.ts"
23
+ ]) {
24
+ return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
25
+ }
26
+ /**
27
+ * Check if the TypeScript configuration type matches any of the provided types.
28
+ *
29
+ * @param tsconfigType - The type from the TypeScript configuration.
30
+ * @param types - An array of type names to check against.
31
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
32
+ */
33
+ function isMatchFound(tsconfigType, types) {
34
+ return findMatch(tsconfigType, types) !== void 0;
35
+ }
36
+
37
+ //#endregion
38
+ exports.isMatchFound = isMatchFound;
@@ -1 +1,35 @@
1
- import e from"defu";import{appendPath as t}from"@stryke/path/append";import{joinPaths as n}from"@stryke/path/join-paths";import{existsSync as r}from"@stryke/fs/exists";import i from"typescript";import"@stryke/fs/json";function a(e,t,n=[`.ts`,`.tsx`,`.d.ts`]){return t.find(t=>e?.toString().toLowerCase()===t?.toString().toLowerCase()||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}`||`./${e?.toString().toLowerCase()}`===t?.toString().toLowerCase()||n.some(n=>`${e?.toString().toLowerCase()}${n}`===t?.toString().toLowerCase()||`${e?.toString().toLowerCase()}${n}`==`./${t?.toString().toLowerCase()}`||`${t?.toString().toLowerCase()}${n}`==`./${e?.toString().toLowerCase()}`||e?.toString().toLowerCase()===`${t?.toString().toLowerCase()}${n}`||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}${n}`||t?.toString().toLowerCase()===`./${e?.toString().toLowerCase()}${n}`))}function o(e,t){return a(e,t)!==void 0}export{o as isMatchFound};
1
+ import defu from "defu";
2
+ import { appendPath } from "@stryke/path/append";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import { existsSync } from "@stryke/fs/exists";
5
+ import ts from "typescript";
6
+ import "@stryke/fs/json";
7
+
8
+ //#region ../powerlines/src/lib/typescript/tsconfig.ts
9
+ /**
10
+ * Check if the TypeScript configuration type matches any of the provided types.
11
+ *
12
+ * @param tsconfigType - The type from the TypeScript configuration.
13
+ * @param types - An array of type names to check against.
14
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
15
+ */
16
+ function findMatch(tsconfigType, types, extensions = [
17
+ ".ts",
18
+ ".tsx",
19
+ ".d.ts"
20
+ ]) {
21
+ return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
22
+ }
23
+ /**
24
+ * Check if the TypeScript configuration type matches any of the provided types.
25
+ *
26
+ * @param tsconfigType - The type from the TypeScript configuration.
27
+ * @param types - An array of type names to check against.
28
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
29
+ */
30
+ function isMatchFound(tsconfigType, types) {
31
+ return findMatch(tsconfigType, types) !== void 0;
32
+ }
33
+
34
+ //#endregion
35
+ export { isMatchFound };