@powerlines/plugin-env 0.14.21 → 0.14.23

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 (128) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/babel/index.cjs +1 -1
  4. package/dist/babel/index.mjs +3 -1
  5. package/dist/babel/plugin.cjs +120 -4
  6. package/dist/babel/plugin.d.cts +2 -3
  7. package/dist/babel/plugin.d.mts +3 -2
  8. package/dist/babel/plugin.mjs +118 -4
  9. package/dist/components/docs.cjs +71 -1
  10. package/dist/components/docs.mjs +70 -1
  11. package/dist/components/env.cjs +432 -11
  12. package/dist/components/env.mjs +430 -9
  13. package/dist/components/index.cjs +6 -1
  14. package/dist/components/index.mjs +4 -1
  15. package/dist/deepkit/schemas/reflection.cjs +3940 -1
  16. package/dist/deepkit/schemas/reflection.mjs +3938 -1
  17. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  18. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  19. package/dist/deepkit/src/capnp.cjs +913 -1
  20. package/dist/deepkit/src/capnp.mjs +911 -1
  21. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  22. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  23. package/dist/deepkit/src/reflect-type.cjs +22 -1
  24. package/dist/deepkit/src/reflect-type.mjs +20 -1
  25. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  26. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  27. package/dist/deepkit/src/transformer.cjs +52 -1
  28. package/dist/deepkit/src/transformer.mjs +49 -1
  29. package/dist/deepkit/src/transpile.cjs +29 -1
  30. package/dist/deepkit/src/transpile.mjs +27 -1
  31. package/dist/deepkit/src/utilities.cjs +66 -1
  32. package/dist/deepkit/src/utilities.mjs +65 -1
  33. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  34. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  35. package/dist/deepkit/src/vendor/type.cjs +20 -1
  36. package/dist/deepkit/src/vendor/type.mjs +11 -1
  37. package/dist/helpers/automd-generator.cjs +22 -1
  38. package/dist/helpers/automd-generator.mjs +21 -1
  39. package/dist/helpers/create-reflection-resource.cjs +55 -1
  40. package/dist/helpers/create-reflection-resource.mjs +54 -1
  41. package/dist/helpers/index.cjs +6 -1
  42. package/dist/helpers/index.mjs +8 -1
  43. package/dist/helpers/load.cjs +83 -1
  44. package/dist/helpers/load.d.cts +2 -2
  45. package/dist/helpers/load.d.mts +3 -2
  46. package/dist/helpers/load.mjs +80 -1
  47. package/dist/helpers/persistence.cjs +214 -1
  48. package/dist/helpers/persistence.d.cts +1 -1
  49. package/dist/helpers/persistence.d.mts +1 -1
  50. package/dist/helpers/persistence.mjs +202 -1
  51. package/dist/helpers/reflect.cjs +111 -1
  52. package/dist/helpers/reflect.mjs +103 -1
  53. package/dist/helpers/source-file-env.cjs +28 -1
  54. package/dist/helpers/source-file-env.mjs +26 -1
  55. package/dist/helpers/template-helpers.cjs +42 -1
  56. package/dist/helpers/template-helpers.mjs +41 -1
  57. package/dist/index.cjs +203 -5
  58. package/dist/index.d.cts +1 -3
  59. package/dist/index.d.mts +2 -1
  60. package/dist/index.mjs +170 -5
  61. package/dist/plugin-alloy/src/core/components/output.cjs +45 -1
  62. package/dist/plugin-alloy/src/core/components/output.mjs +44 -1
  63. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  64. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  65. package/dist/plugin-alloy/src/index.cjs +93 -1
  66. package/dist/plugin-alloy/src/index.mjs +91 -1
  67. package/dist/plugin-alloy/src/types/plugin.d.cts +2 -2
  68. package/dist/plugin-alloy/src/types/plugin.d.mts +2 -2
  69. package/dist/plugin-automd/src/index.cjs +101 -1
  70. package/dist/plugin-automd/src/index.mjs +98 -1
  71. package/dist/plugin-automd/src/types/plugin.d.mts +2 -2
  72. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  73. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  74. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  75. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  76. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  77. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  78. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  79. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  80. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  81. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  82. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  83. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  84. package/dist/plugin-babel/src/index.cjs +91 -1
  85. package/dist/plugin-babel/src/index.mjs +89 -1
  86. package/dist/plugin-babel/src/types/plugin.d.cts +2 -2
  87. package/dist/plugin-babel/src/types/plugin.d.mts +2 -2
  88. package/dist/powerlines/schemas/fs.d.mts +1 -0
  89. package/dist/powerlines/src/api.d.mts +7 -0
  90. package/dist/powerlines/src/index.d.mts +12 -0
  91. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  92. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  93. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  94. package/dist/powerlines/src/lib/entry.cjs +12 -1
  95. package/dist/powerlines/src/lib/entry.mjs +14 -1
  96. package/dist/powerlines/src/lib/logger.cjs +41 -1
  97. package/dist/powerlines/src/lib/logger.mjs +39 -1
  98. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  99. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  100. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  101. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  102. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  103. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  104. package/dist/powerlines/src/types/api.d.mts +5 -0
  105. package/dist/powerlines/src/types/babel.d.cts +3 -2
  106. package/dist/powerlines/src/types/babel.d.mts +3 -2
  107. package/dist/powerlines/src/types/commands.d.cts +1 -1
  108. package/dist/powerlines/src/types/commands.d.mts +2 -2
  109. package/dist/powerlines/src/types/config.d.cts +5 -5
  110. package/dist/powerlines/src/types/config.d.mts +6 -6
  111. package/dist/powerlines/src/types/context.d.cts +28 -4
  112. package/dist/powerlines/src/types/context.d.mts +30 -6
  113. package/dist/powerlines/src/types/fs.d.cts +1 -1
  114. package/dist/powerlines/src/types/fs.d.mts +1 -1
  115. package/dist/powerlines/src/types/index.d.mts +12 -0
  116. package/dist/powerlines/src/types/plugin.d.cts +3 -3
  117. package/dist/powerlines/src/types/plugin.d.mts +4 -4
  118. package/dist/powerlines/src/types/resolved.d.cts +1 -1
  119. package/dist/powerlines/src/types/resolved.d.mts +2 -2
  120. package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
  121. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  122. package/dist/types/index.mjs +1 -1
  123. package/dist/types/plugin.d.cts +1 -1
  124. package/dist/types/plugin.mjs +1 -1
  125. package/dist/types/runtime.mjs +1 -1
  126. package/package.json +16 -16
  127. package/dist/babel/index.d.cts +0 -1
  128. package/dist/helpers/index.d.cts +0 -6
@@ -1,14 +1,100 @@
1
- import"../entry.mjs";import{replacePath as e}from"@stryke/path/replace";import{joinPaths as t}from"@stryke/path/join-paths";import n from"defu";import{isString as r}from"@stryke/type-checks/is-string";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(e){let r=e.config.build.override.inject??e.config.build.inject;return r&&Object.keys(r).length>0&&e.fs.writeSync(t(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`),Object.entries(r).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
- `)),n({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:r&&Object.keys(r).length>0?[t(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`)]:void 0},e.config.build.variant===`esbuild`?i(e.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},e.config.build.variant===`esbuild`?i(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`},o)}export{s as extractESBuildConfig};
1
+ import "../entry.mjs";
2
+ import { replacePath } from "@stryke/path/replace";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import defu from "defu";
5
+ import { isString } from "@stryke/type-checks/is-string";
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/path/replace`),t=require(`@stryke/convert/to-array`),n=require(`@stryke/fs/is-file`),r=require(`@stryke/fs/list-files`),i=require(`@stryke/path/append`),a=require(`@stryke/path/join-paths`),o=require(`@stryke/type-checks/is-set-string`),s=require(`@stryke/type-checks/is-string`),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_path_replace = require("@stryke/path/replace");
3
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
4
+ let __stryke_fs_is_file = require("@stryke/fs/is-file");
5
+ let __stryke_fs_list_files = require("@stryke/fs/list-files");
6
+ let __stryke_path_append = require("@stryke/path/append");
7
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
8
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
9
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
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{replacePath as e}from"@stryke/path/replace";import{toArray as t}from"@stryke/convert/to-array";import"@stryke/fs/is-file";import{listFiles as n}from"@stryke/fs/list-files";import{appendPath as r}from"@stryke/path/append";import{joinPaths as i}from"@stryke/path/join-paths";import{isSetString as a}from"@stryke/type-checks/is-set-string";import{isString as o}from"@stryke/type-checks/is-string";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 { replacePath } from "@stryke/path/replace";
3
+ import { toArray } from "@stryke/convert/to-array";
4
+ import "@stryke/fs/is-file";
5
+ import { listFiles } from "@stryke/fs/list-files";
6
+ import { appendPath } from "@stryke/path/append";
7
+ import { joinPaths } from "@stryke/path/join-paths";
8
+ import { isSetString } from "@stryke/type-checks/is-set-string";
9
+ import { isString } from "@stryke/type-checks/is-string";
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,35 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../build/esbuild.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`esbuild`);async function i(e,i,a={}){let o=await e.fs.resolve(i);if(!o||!e.fs.existsSync(o))throw Error(`Module not found: "${i}". Please check the path and try again.`);let s=await(0,r.build)({...t.extractESBuildConfig(e),entryPoints:[o],write:!1,sourcemap:!1,splitting:!1,treeShaking:!1,bundle:!0,...a});if(s.errors.length>0)throw Error(`Failed to transpile ${i}: ${s.errors.map(e=>e.text).join(`, `)}`);if(s.warnings.length>0&&e.log(n.LogLevelLabel.WARN,`Warnings while transpiling ${i}: ${s.warnings.map(e=>e.text).join(`, `)}`),!s.outputFiles||s.outputFiles.filter(Boolean).length===0)throw Error(`No output files generated for ${i}. Please check the configuration and try again.`);return s.outputFiles.filter(Boolean)[0]}exports.bundle=i;
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 +1,34 @@
1
- import{extractESBuildConfig as e}from"../build/esbuild.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import{build as n}from"esbuild";async function r(r,i,a={}){let o=await r.fs.resolve(i);if(!o||!r.fs.existsSync(o))throw Error(`Module not found: "${i}". Please check the path and try again.`);let s=await n({...e(r),entryPoints:[o],write:!1,sourcemap:!1,splitting:!1,treeShaking:!1,bundle:!0,...a});if(s.errors.length>0)throw Error(`Failed to transpile ${i}: ${s.errors.map(e=>e.text).join(`, `)}`);if(s.warnings.length>0&&r.log(t.WARN,`Warnings while transpiling ${i}: ${s.warnings.map(e=>e.text).join(`, `)}`),!s.outputFiles||s.outputFiles.filter(Boolean).length===0)throw Error(`No output files generated for ${i}. Please check the configuration and try again.`);return s.outputFiles.filter(Boolean)[0]}export{r as bundle};
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 +1,30 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`./bundle.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/convert/parse-type-definition`);async function i(e,i,a={}){let o;o=(0,n.isSetString)(i)?(0,r.parseTypeDefinition)(i):i;let s=await t.bundle(e,o.file,a),c=await e.resolver.evalModule(s.text,{filename:s.path,forceTranspile:!0}),l=o.name;return l||=`default`,c[l]??c[`__Ω${l}`]}exports.resolve=i;
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_bundle = require('./bundle.cjs');
3
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
+ let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
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 +1,29 @@
1
- import{bundle as e}from"./bundle.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{parseTypeDefinition as n}from"@stryke/convert/parse-type-definition";async function r(r,i,a={}){let o;o=t(i)?n(i):i;let s=await e(r,o.file,a),c=await r.resolver.evalModule(s.text,{filename:s.path,forceTranspile:!0}),l=o.name;return l||=`default`,c[l]??c[`__Ω${l}`]}export{r as resolve};
1
+ import { bundle } from "./bundle.mjs";
2
+ import { isSetString } from "@stryke/type-checks/is-set-string";
3
+ import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
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 +1 @@
1
- let e=require(`@stryke/path/replace`);
1
+ let __stryke_path_replace = require("@stryke/path/replace");
@@ -1 +1,3 @@
1
- import{replacePath as e}from"@stryke/path/replace";export{};
1
+ import { replacePath } from "@stryke/path/replace";
2
+
3
+ export { };
@@ -0,0 +1,5 @@
1
+ import "./resolved.mjs";
2
+ import "./config.mjs";
3
+ import "./hooks.mjs";
4
+ import "./context.mjs";
5
+ import "../internal/helpers/hooks.mjs";
@@ -1,5 +1,5 @@
1
- import { Context } from "./context.cjs";
2
1
  import { LogFn } from "./config.cjs";
2
+ import { Context } from "./context.cjs";
3
3
  import { PluginItem, PluginObj, PluginPass } from "@babel/core";
4
4
  import { BabelAPI } from "@babel/helper-plugin-utils";
5
5
 
@@ -18,5 +18,6 @@ type BabelTransformPlugin<TContext extends Context = Context, TOptions extends R
18
18
  $$name: string;
19
19
  };
20
20
  type BabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | BabelTransformPlugin<TContext, TOptions, TState> | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions] | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter];
21
+ type DeclareBabelTransformPluginReturn<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = Omit<BabelTransformPlugin<TContext, TOptions, TState>, "$$name"> & Required<Pick<BabelTransformPlugin<TContext, TOptions, TState>, "$$name">>;
21
22
  //#endregion
22
- export { BabelTransformPluginOptions };
23
+ export { BabelTransformPluginOptions, DeclareBabelTransformPluginReturn };
@@ -1,5 +1,5 @@
1
- import { Context } from "./context.mjs";
2
1
  import { LogFn } from "./config.mjs";
2
+ import { Context } from "./context.mjs";
3
3
  import { PluginItem, PluginObj, PluginPass } from "@babel/core";
4
4
  import { BabelAPI } from "@babel/helper-plugin-utils";
5
5
 
@@ -18,5 +18,6 @@ type BabelTransformPlugin<TContext extends Context = Context, TOptions extends R
18
18
  $$name: string;
19
19
  };
20
20
  type BabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | BabelTransformPlugin<TContext, TOptions, TState> | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions] | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter];
21
+ type DeclareBabelTransformPluginReturn<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = Omit<BabelTransformPlugin<TContext, TOptions, TState>, "$$name"> & Required<Pick<BabelTransformPlugin<TContext, TOptions, TState>, "$$name">>;
21
22
  //#endregion
22
- export { BabelTransformPluginOptions };
23
+ export { BabelPluginPass, BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions, DeclareBabelTransformPluginReturn };
@@ -1,5 +1,5 @@
1
- import { MaybePromise } from "@stryke/types/base";
2
1
  import { ArrayValues } from "@stryke/types/array";
2
+ import { MaybePromise } from "@stryke/types/base";
3
3
 
4
4
  //#region ../powerlines/src/types/commands.d.ts
5
5
  declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
@@ -1,9 +1,9 @@
1
1
  import "./context.mjs";
2
- import { MaybePromise } from "@stryke/types/base";
3
2
  import { ArrayValues } from "@stryke/types/array";
3
+ import { MaybePromise } from "@stryke/types/base";
4
4
 
5
5
  //#region ../powerlines/src/types/commands.d.ts
6
6
  declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
7
7
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
8
8
  //#endregion
9
- export { CommandType };
9
+ export { CommandType, SUPPORTED_COMMANDS };
@@ -1,18 +1,18 @@
1
- import { StoragePort, StoragePreset } from "./fs.cjs";
1
+ import { BabelTransformPluginOptions } from "./babel.cjs";
2
2
  import { BuildConfig, BuildResolvedConfig } from "./build.cjs";
3
+ import { StoragePort, StoragePreset } from "./fs.cjs";
3
4
  import { Plugin } from "./plugin.cjs";
4
5
  import { TSConfig } from "./tsconfig.cjs";
5
6
  import { PluginContext } from "./context.cjs";
6
- import { BabelTransformPluginOptions } from "./babel.cjs";
7
7
  import { MaybePromise } from "@stryke/types/base";
8
- import { AssetGlob } from "@stryke/types/file";
9
- import { TypeDefinitionParameter } from "@stryke/types/configuration";
10
- import { PreviewOptions } from "vite";
11
8
  import { transformAsync } from "@babel/core";
12
9
  import { Format } from "@storm-software/build-tools/types";
13
10
  import { LogLevelLabel } from "@storm-software/config-tools/types";
14
11
  import { StormWorkspaceConfig } from "@storm-software/config/types";
12
+ import { TypeDefinitionParameter } from "@stryke/types/configuration";
13
+ import { AssetGlob } from "@stryke/types/file";
15
14
  import { DateString } from "compatx";
15
+ import { PreviewOptions } from "vite";
16
16
 
17
17
  //#region ../powerlines/src/types/config.d.ts
18
18
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -1,19 +1,19 @@
1
- import { StoragePort, StoragePreset } from "./fs.mjs";
1
+ import { BabelTransformPluginOptions } from "./babel.mjs";
2
2
  import { BuildConfig, BuildResolvedConfig } from "./build.mjs";
3
+ import { StoragePort, StoragePreset } from "./fs.mjs";
3
4
  import { Plugin } from "./plugin.mjs";
4
5
  import { TSConfig } from "./tsconfig.mjs";
5
6
  import { PluginContext } from "./context.mjs";
6
- import { BabelTransformPluginOptions } from "./babel.mjs";
7
7
  import "c12";
8
8
  import { transformAsync } from "@babel/core";
9
9
  import { LogLevelLabel } from "@storm-software/config-tools/types";
10
10
  import { MaybePromise } from "@stryke/types/base";
11
- import { AssetGlob } from "@stryke/types/file";
12
- import { TypeDefinitionParameter } from "@stryke/types/configuration";
13
- import { PreviewOptions } from "vite";
14
11
  import { Format } from "@storm-software/build-tools/types";
15
12
  import { StormWorkspaceConfig } from "@storm-software/config/types";
13
+ import { TypeDefinitionParameter } from "@stryke/types/configuration";
14
+ import { AssetGlob } from "@stryke/types/file";
16
15
  import { DateString } from "compatx";
16
+ import { PreviewOptions } from "vite";
17
17
 
18
18
  //#region ../powerlines/src/types/config.d.ts
19
19
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -378,4 +378,4 @@ type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserCo
378
378
  command: PowerlinesCommand;
379
379
  };
380
380
  //#endregion
381
- export { BabelUserConfig, EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, UserConfig, WorkspaceConfig };
381
+ export { BabelUserConfig, BaseConfig, CommonUserConfig, DeployConfig, EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, ProjectType, UserConfig, WorkspaceConfig };
@@ -1,7 +1,7 @@
1
1
  import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.cjs";
2
+ import { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition } from "./resolved.cjs";
2
3
  import { ParsedTypeScriptConfig } from "./tsconfig.cjs";
3
4
  import { InlineConfig, LogFn, UserConfig, WorkspaceConfig } from "./config.cjs";
4
- import { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition } from "./resolved.cjs";
5
5
  import { NonUndefined } from "@stryke/types/base";
6
6
  import { EnvPaths } from "@stryke/env/get-env-paths";
7
7
  import { FetchRequestOptions } from "@stryke/http/fetch";
@@ -89,10 +89,18 @@ interface ParseOptions extends ParserOptions {
89
89
  */
90
90
  allowReturnOutsideFunction?: boolean;
91
91
  }
92
+ interface EmitOptions extends WriteOptions {
93
+ /**
94
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
95
+ */
96
+ emitWithBundler?: boolean;
97
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
98
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
99
+ }
92
100
  /**
93
101
  * Options for emitting entry virtual files
94
102
  */
95
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
103
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
96
104
  /**
97
105
  * The unresolved Powerlines context.
98
106
  *
@@ -303,6 +311,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
303
311
  * The Powerlines builtin virtual files
304
312
  */
305
313
  getBuiltins: () => Promise<VirtualFile[]>;
314
+ /**
315
+ * Resolves a file and writes it to the VFS if it does not already exist
316
+ *
317
+ * @param code - The source code of the file
318
+ * @param path - The path to write the file to
319
+ * @param options - Additional options for writing the file
320
+ */
321
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
322
+ /**
323
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
324
+ *
325
+ * @param code - The source code of the file
326
+ * @param path - The path to write the file to
327
+ * @param options - Additional options for writing the file
328
+ */
329
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
306
330
  /**
307
331
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
308
332
  *
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
335
  * @param path - An optional path to write the builtin file to
312
336
  * @param options - Additional options for writing the builtin file
313
337
  */
314
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
338
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
315
339
  /**
316
340
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
317
341
  *
@@ -320,7 +344,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
320
344
  * @param path - An optional path to write the builtin file to
321
345
  * @param options - Additional options for writing the builtin file
322
346
  */
323
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
347
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
324
348
  /**
325
349
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
326
350
  *