powerlines 0.37.46 → 0.37.48

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 (121) hide show
  1. package/dist/api.cjs +2 -2
  2. package/dist/api.js +1 -1
  3. package/dist/astro.cjs +4 -4
  4. package/dist/astro.js +3 -3
  5. package/dist/{chunk-BG4PIMQN.js → chunk-4FVFLFM4.js} +3 -3
  6. package/dist/{chunk-ST2QOD7K.js → chunk-4WEH6AVM.js} +3 -3
  7. package/dist/{chunk-RUYGKNBM.cjs → chunk-5CS3SA6L.cjs} +13 -16
  8. package/dist/{chunk-RULSJ2SK.cjs → chunk-7UXBCXVJ.cjs} +5 -5
  9. package/dist/chunk-AW6C4DWM.cjs +12 -0
  10. package/dist/{chunk-DFLUJMCI.js → chunk-GQVZRQVK.js} +3 -3
  11. package/dist/chunk-IO35IUH6.cjs +12 -0
  12. package/dist/{chunk-2KFVP7PK.js → chunk-LKUQJLHC.js} +13 -16
  13. package/dist/{chunk-YJRPFM2Q.js → chunk-MY343XCM.js} +3 -3
  14. package/dist/{chunk-SV5CZ6T5.js → chunk-NTPXZRHH.js} +3 -3
  15. package/dist/{chunk-ENEMWUFY.cjs → chunk-UNDSA2X3.cjs} +4 -4
  16. package/dist/{chunk-5HQYRBKT.cjs → chunk-VBEMP5YX.cjs} +4 -4
  17. package/dist/esbuild.cjs +6 -6
  18. package/dist/esbuild.js +3 -3
  19. package/dist/farm.cjs +3 -3
  20. package/dist/farm.js +2 -2
  21. package/dist/index.cjs +10 -10
  22. package/dist/index.js +2 -2
  23. package/dist/lib/build/esbuild.cjs +5 -5
  24. package/dist/lib/build/esbuild.js +2 -2
  25. package/dist/lib/build/index.cjs +12 -12
  26. package/dist/lib/build/index.js +4 -4
  27. package/dist/lib/build/tsup.cjs +6 -6
  28. package/dist/lib/build/tsup.js +3 -3
  29. package/dist/lib/build/vite.cjs +5 -5
  30. package/dist/lib/build/vite.js +3 -3
  31. package/dist/lib/{chunk-WPRZ6Y3Q.js → chunk-2EQUUYQN.js} +4 -4
  32. package/dist/lib/{chunk-WPRZ6Y3Q.js.map → chunk-2EQUUYQN.js.map} +1 -1
  33. package/dist/lib/{chunk-7XIWJ5IH.js → chunk-2UPJNXRQ.js} +3 -3
  34. package/dist/lib/{chunk-7XIWJ5IH.js.map → chunk-2UPJNXRQ.js.map} +1 -1
  35. package/dist/lib/{chunk-ZQG74VOL.cjs → chunk-3HKUPTJN.cjs} +5 -4
  36. package/dist/lib/chunk-3HKUPTJN.cjs.map +1 -0
  37. package/dist/lib/{chunk-LCVRVKWP.cjs → chunk-4B7KHLRF.cjs} +4 -4
  38. package/dist/lib/{chunk-LCVRVKWP.cjs.map → chunk-4B7KHLRF.cjs.map} +1 -1
  39. package/dist/lib/{chunk-46GTIY7J.cjs → chunk-4DHAO64T.cjs} +4 -4
  40. package/dist/lib/{chunk-46GTIY7J.cjs.map → chunk-4DHAO64T.cjs.map} +1 -1
  41. package/dist/lib/{chunk-EQLYPKNF.cjs → chunk-4FN2T7TG.cjs} +19 -19
  42. package/dist/lib/{chunk-EQLYPKNF.cjs.map → chunk-4FN2T7TG.cjs.map} +1 -1
  43. package/dist/lib/{chunk-R7AYD5WD.js → chunk-6X734A6A.js} +3 -3
  44. package/dist/lib/{chunk-R7AYD5WD.js.map → chunk-6X734A6A.js.map} +1 -1
  45. package/dist/lib/{chunk-LXD3CZ3T.cjs → chunk-A6RKKQOZ.cjs} +17 -17
  46. package/dist/lib/{chunk-LXD3CZ3T.cjs.map → chunk-A6RKKQOZ.cjs.map} +1 -1
  47. package/dist/lib/{chunk-HMFL5QT6.js → chunk-DRNTY33R.js} +3 -3
  48. package/dist/lib/{chunk-HMFL5QT6.js.map → chunk-DRNTY33R.js.map} +1 -1
  49. package/dist/lib/{chunk-PTVOWTSC.js → chunk-DZVIUIPX.js} +11 -14
  50. package/dist/lib/chunk-DZVIUIPX.js.map +1 -0
  51. package/dist/lib/{chunk-DXM5MX7M.js → chunk-FPZFHWK3.js} +5 -5
  52. package/dist/lib/{chunk-DXM5MX7M.js.map → chunk-FPZFHWK3.js.map} +1 -1
  53. package/dist/lib/{chunk-IYGMYKFU.js → chunk-L76ESU2M.js} +5 -4
  54. package/dist/lib/chunk-L76ESU2M.js.map +1 -0
  55. package/dist/lib/{chunk-QOL47PXI.cjs → chunk-M4QQN724.cjs} +13 -16
  56. package/dist/lib/chunk-M4QQN724.cjs.map +1 -0
  57. package/dist/lib/{chunk-AX3FBF6F.cjs → chunk-PX45HDHT.cjs} +4 -4
  58. package/dist/lib/{chunk-AX3FBF6F.cjs.map → chunk-PX45HDHT.cjs.map} +1 -1
  59. package/dist/lib/{chunk-GKUDVJPX.cjs → chunk-RK5MATYS.cjs} +4 -4
  60. package/dist/lib/{chunk-GKUDVJPX.cjs.map → chunk-RK5MATYS.cjs.map} +1 -1
  61. package/dist/lib/{chunk-VL5H4HKR.js → chunk-S3GKFOT6.js} +3 -3
  62. package/dist/lib/{chunk-VL5H4HKR.js.map → chunk-S3GKFOT6.js.map} +1 -1
  63. package/dist/lib/{chunk-2OW63XO3.js → chunk-SZ6UL7UR.js} +3 -3
  64. package/dist/lib/{chunk-2OW63XO3.js.map → chunk-SZ6UL7UR.js.map} +1 -1
  65. package/dist/lib/{chunk-5QBG6QCZ.cjs → chunk-W7CB6FMG.cjs} +6 -6
  66. package/dist/lib/{chunk-5QBG6QCZ.cjs.map → chunk-W7CB6FMG.cjs.map} +1 -1
  67. package/dist/lib/{chunk-MWW5SYZW.cjs → chunk-XJJATLHR.cjs} +4 -4
  68. package/dist/lib/{chunk-MWW5SYZW.cjs.map → chunk-XJJATLHR.cjs.map} +1 -1
  69. package/dist/lib/{chunk-IQXV4B5Z.js → chunk-ZJ64SOWW.js} +3 -3
  70. package/dist/lib/{chunk-IQXV4B5Z.js.map → chunk-ZJ64SOWW.js.map} +1 -1
  71. package/dist/lib/contexts/api-context.cjs +5 -5
  72. package/dist/lib/contexts/api-context.js +4 -4
  73. package/dist/lib/contexts/context.cjs +3 -3
  74. package/dist/lib/contexts/context.js +2 -2
  75. package/dist/lib/contexts/environment-context.cjs +4 -4
  76. package/dist/lib/contexts/environment-context.js +3 -3
  77. package/dist/lib/contexts/index.cjs +7 -7
  78. package/dist/lib/contexts/index.js +4 -4
  79. package/dist/lib/entry.cjs +10 -10
  80. package/dist/lib/entry.js +1 -1
  81. package/dist/lib/index.cjs +23 -23
  82. package/dist/lib/index.js +8 -8
  83. package/dist/lib/unplugin/factory.cjs +6 -6
  84. package/dist/lib/unplugin/factory.js +5 -5
  85. package/dist/lib/unplugin/index.cjs +6 -6
  86. package/dist/lib/unplugin/index.js +5 -5
  87. package/dist/lib/utilities/bundle.cjs +4 -4
  88. package/dist/lib/utilities/bundle.js +3 -3
  89. package/dist/lib/utilities/index.cjs +6 -6
  90. package/dist/lib/utilities/index.js +4 -4
  91. package/dist/lib/utilities/resolve.cjs +5 -5
  92. package/dist/lib/utilities/resolve.js +4 -4
  93. package/dist/next.cjs +4 -4
  94. package/dist/next.js +3 -3
  95. package/dist/nuxt.cjs +8 -8
  96. package/dist/nuxt.js +4 -4
  97. package/dist/rolldown.cjs +6 -6
  98. package/dist/rolldown.js +3 -3
  99. package/dist/rollup.cjs +3 -3
  100. package/dist/rollup.js +2 -2
  101. package/dist/rspack.cjs +3 -3
  102. package/dist/rspack.js +2 -2
  103. package/dist/tsdown.cjs +4 -4
  104. package/dist/tsdown.js +3 -3
  105. package/dist/tsup.cjs +4 -4
  106. package/dist/tsup.js +3 -3
  107. package/dist/unloader.cjs +3 -3
  108. package/dist/unloader.js +2 -2
  109. package/dist/unplugin.cjs +8 -8
  110. package/dist/unplugin.js +4 -4
  111. package/dist/vite.cjs +6 -6
  112. package/dist/vite.js +3 -3
  113. package/dist/webpack.cjs +6 -6
  114. package/dist/webpack.js +3 -3
  115. package/package.json +3 -3
  116. package/dist/chunk-7OGAS5PG.cjs +0 -12
  117. package/dist/chunk-FBUBCGXH.cjs +0 -12
  118. package/dist/lib/chunk-IYGMYKFU.js.map +0 -1
  119. package/dist/lib/chunk-PTVOWTSC.js.map +0 -1
  120. package/dist/lib/chunk-QOL47PXI.cjs.map +0 -1
  121. package/dist/lib/chunk-ZQG74VOL.cjs.map +0 -1
@@ -5,6 +5,7 @@ import { toArray } from '@stryke/convert/to-array';
5
5
  import { murmurhash } from '@stryke/hash/murmurhash';
6
6
  import { getUniqueBy } from '@stryke/helpers/get-unique';
7
7
  import { appendPath } from '@stryke/path/append';
8
+ import { isAbsolutePath } from '@stryke/path/is-type';
8
9
  import { joinPaths } from '@stryke/path/join-paths';
9
10
  import { replacePath, replaceExtension } from '@stryke/path/replace';
10
11
  import { isSetString } from '@stryke/type-checks/is-set-string';
@@ -49,7 +50,7 @@ async function resolveEntries(context, typeDefinitions) {
49
50
  typeDefinition = entry;
50
51
  typeDefinition.file = replacePathTokens(context, typeDefinition.file);
51
52
  }
52
- const filePath = appendPath(typeDefinition.file, context.config.projectRoot);
53
+ const filePath = isAbsolutePath(typeDefinition.file) ? typeDefinition.file : appendPath(typeDefinition.file, context.config.projectRoot);
53
54
  if (await context.fs.isFile(filePath)) {
54
55
  return resolveEntry(context, {
55
56
  file: replacePath(filePath, context.config.projectRoot),
@@ -86,7 +87,7 @@ function resolveEntriesSync(context, typeDefinitions) {
86
87
  typeDefinition = entry;
87
88
  typeDefinition.file = replacePathTokens(context, typeDefinition.file);
88
89
  }
89
- const filePath = appendPath(typeDefinition.file, context.config.projectRoot);
90
+ const filePath = isAbsolutePath(typeDefinition.file) ? typeDefinition.file : appendPath(typeDefinition.file, context.config.projectRoot);
90
91
  if (context.fs.isFileSync(filePath)) {
91
92
  return resolveEntry(context, {
92
93
  file: replacePath(filePath, context.config.projectRoot),
@@ -108,5 +109,5 @@ function getUniqueEntries(entries = []) {
108
109
  __name(getUniqueEntries, "getUniqueEntries");
109
110
 
110
111
  export { getUniqueEntries, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntries, resolveEntriesSync, resolveEntry, resolveEntryInput, resolveEntryInputFile, resolveEntryOutput };
111
- //# sourceMappingURL=chunk-IYGMYKFU.js.map
112
- //# sourceMappingURL=chunk-IYGMYKFU.js.map
112
+ //# sourceMappingURL=chunk-L76ESU2M.js.map
113
+ //# sourceMappingURL=chunk-L76ESU2M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/entry.ts"],"names":["resolveEntryInputFile","context","typeDefinition","replacePath","file","joinPaths","workspaceConfig","workspaceRoot","config","projectRoot","resolveEntryInput","name","resolveEntryOutput","replaceExtension","sourceRoot","resolveEntry","input","output","resolveEntries","typeDefinitions","Promise","all","map","entry","isResolvedEntryTypeDefinition","replacePathTokens","isString","parseTypeDefinition","filePath","isAbsolutePath","appendPath","fs","isFile","glob","flat","filter","Boolean","isTypeDefinition","undefined","resolveEntriesSync","isFileSync","globSync","getUniqueEntries","entries","getUniqueBy","toArray","item","isSetString","murmurhash","maxLength"],"mappings":";;;;;;;;;;;;;AAoCO,SAASA,qBAAAA,CACdC,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAOC,WAAAA,CACLD,cAAAA,CAAeE,IAAAA,EACfC,SAAAA,CAAUJ,OAAAA,CAAQK,gBAAgBC,aAAAA,EAAeN,OAAAA,CAAQO,MAAAA,CAAOC,WAAW,CAAA,CAAA;AAE/E;AARgBT,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAUT,SAASU,iBAAAA,CACdT,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAO;IACLE,IAAAA,EAAMJ,qBAAAA,CAAsBC,SAASC,cAAAA,CAAAA;AACrCS,IAAAA,IAAAA,EAAMT,cAAAA,CAAeS;AACvB,GAAA;AACF;AARgBD,MAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA;AAUT,SAASE,kBAAAA,CACdX,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAOW,iBACLV,WAAAA,CACEA,WAAAA,CACEA,YACEA,WAAAA,CACEA,WAAAA,C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":"chunk-L76ESU2M.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport type { Context } from \"../types/context\";\nimport { ResolvedEntryTypeDefinition } from \"../types/resolved\";\n\nexport function resolveEntryInputFile(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replacePath(\n typeDefinition.file,\n joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)\n );\n}\n\nexport function resolveEntryInput(\n context: Context,\n typeDefinition: TypeDefinition\n): TypeDefinition {\n return {\n file: resolveEntryInputFile(context, typeDefinition),\n name: typeDefinition.name\n };\n}\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.sourceRoot\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot\n )\n ),\n context.config.sourceRoot\n ),\n context.config.projectRoot\n ),\n replacePath(context.config.sourceRoot, context.config.projectRoot)\n )\n );\n}\n\nexport function resolveEntry(\n context: Context,\n typeDefinition: TypeDefinition\n): ResolvedEntryTypeDefinition {\n const input = resolveEntryInput(context, typeDefinition);\n\n return {\n ...input,\n input,\n output: resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveEntries(\n context: Context,\n typeDefinitions: Array<TypeDefinitionParameter | ResolvedEntryTypeDefinition>\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n typeDefinitions.map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return { ...entry, file: replacePathTokens(context, entry.file) };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.projectRoot);\n if (await context.fs.isFile(filePath)) {\n return resolveEntry(context, {\n file: replacePath(filePath, context.config.projectRoot),\n name: typeDefinition.name\n });\n }\n\n return (\n await context.fs.glob(\n appendPath(filePath, context.workspaceConfig.workspaceRoot)\n )\n ).map(file =>\n resolveEntry(context, {\n file: replacePath(file, context.config.projectRoot),\n name: typeDefinition.name\n })\n );\n })\n )\n )\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(\n entry: TypeDefinitionParameter\n): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).input !== undefined &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveEntriesSync(\n context: Context,\n typeDefinitions: Array<TypeDefinitionParameter | ResolvedEntryTypeDefinition>\n): ResolvedEntryTypeDefinition[] {\n return typeDefinitions\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return { ...entry, file: replacePathTokens(context, entry.file) };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.projectRoot);\n if (context.fs.isFileSync(filePath)) {\n return resolveEntry(context, {\n file: replacePath(filePath, context.config.projectRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs\n .globSync(appendPath(filePath, context.workspaceConfig.workspaceRoot))\n .map(file =>\n resolveEntry(context, {\n file: replacePath(file, context.config.projectRoot),\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n// /** Resolve a virtual entry point by generating a unique file path in the artifacts directory.\n// *\n// * @param context - The current context\n// * @param typeDefinition - The type definition to resolve.\n// * @returns The resolved entry type definition with a unique virtual file path.\n// */\n// export function resolveVirtualEntry(\n// context: Context,\n// typeDefinition: TypeDefinitionParameter\n// ): ResolvedEntryTypeDefinition {\n// const parsed = parseTypeDefinition(typeDefinition)!;\n// const resolved = resolveEntry(context, parsed);\n// const file = joinPaths(\n// context.artifactsPath,\n// `entry-${murmurhash(\n// { file: resolved.file, name: resolved.name },\n// { maxLength: 24 }\n// )\n// .replaceAll(\"-\", \"0\")\n// .replaceAll(\"_\", \"1\")}.ts`\n// );\n\n// return {\n// file,\n// name: resolved.name,\n// input: {\n// file,\n// name: resolved.name\n// },\n// output: file\n// };\n// }\n\n/**\n * Get unique entries from the provided list.\n *\n * @param entries - The entries to process.\n * @returns An array of unique entries (by file path or content hash).\n */\nexport function getUniqueEntries(\n entries: TypeDefinitionParameter | TypeDefinitionParameter[] = []\n): TypeDefinitionParameter[] {\n return getUniqueBy(toArray(entries), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"]}
@@ -7,7 +7,7 @@ var chunk64R4MDJ7_cjs = require('./chunk-64R4MDJ7.cjs');
7
7
  var chunk2XCDEMMO_cjs = require('./chunk-2XCDEMMO.cjs');
8
8
  var chunk2JR645O3_cjs = require('./chunk-2JR645O3.cjs');
9
9
  var chunkGFUPZMLG_cjs = require('./chunk-GFUPZMLG.cjs');
10
- var chunkZQG74VOL_cjs = require('./chunk-ZQG74VOL.cjs');
10
+ var chunk3HKUPTJN_cjs = require('./chunk-3HKUPTJN.cjs');
11
11
  var chunkYF57WETC_cjs = require('./chunk-YF57WETC.cjs');
12
12
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
13
13
  var types = require('@storm-software/config-tools/types');
@@ -338,7 +338,7 @@ var PowerlinesContext = class _PowerlinesContext {
338
338
  */
339
339
  get entry() {
340
340
  const entry = this._entry;
341
- return chunkZQG74VOL_cjs.resolveEntriesSync(this, !entry || entry.length === 0 ? toArray.toArray(this.config.entry) : entry);
341
+ return chunk3HKUPTJN_cjs.resolveEntriesSync(this, !entry || entry.length === 0 ? toArray.toArray(this.config.entry) : entry);
342
342
  }
343
343
  /**
344
344
  * The TypeScript configuration parsed from the tsconfig file
@@ -542,10 +542,10 @@ var PowerlinesContext = class _PowerlinesContext {
542
542
  */
543
543
  get _entry() {
544
544
  return Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
545
+ const typeDefinition = {
546
+ file: path
547
+ };
545
548
  if (meta.properties) {
546
- const typeDefinition = {
547
- file: path
548
- };
549
549
  if (isSetString.isSetString(meta.properties.name)) {
550
550
  typeDefinition.name = meta.properties.name;
551
551
  }
@@ -561,9 +561,8 @@ var PowerlinesContext = class _PowerlinesContext {
561
561
  if (isSetString.isSetString(meta.properties.output)) {
562
562
  typeDefinition.output = meta.properties.output;
563
563
  }
564
- return typeDefinition;
565
564
  }
566
- return void 0;
565
+ return typeDefinition;
567
566
  }).filter(Boolean);
568
567
  }
569
568
  /**
@@ -823,12 +822,11 @@ var PowerlinesContext = class _PowerlinesContext {
823
822
  * @param options - Optional write file options
824
823
  */
825
824
  async emitEntry(code, path, options = {}) {
826
- const entryPath = append.appendPath(replace.replacePath(replace.replacePath(replace.replacePath(path, this.entryPath), this.config.projectRoot), this.workspaceConfig.workspaceRoot), this.entryPath);
827
- return this.emit(code, entryPath, defu2__default.default({
825
+ return this.emit(code, append.appendPath(path, this.entryPath), defu2__default.default({
828
826
  meta: {
829
827
  type: "entry",
830
828
  properties: {
831
- file: entryPath,
829
+ file: append.appendPath(path, this.entryPath),
832
830
  name: options?.name,
833
831
  output: options?.output,
834
832
  "input.file": options?.input?.file,
@@ -847,12 +845,11 @@ var PowerlinesContext = class _PowerlinesContext {
847
845
  * @param options - Optional write file options
848
846
  */
849
847
  emitEntrySync(code, path, options = {}) {
850
- const entryPath = append.appendPath(replace.replacePath(replace.replacePath(replace.replacePath(path, this.entryPath), this.config.projectRoot), this.workspaceConfig.workspaceRoot), this.entryPath);
851
- return this.emitSync(code, entryPath, defu2__default.default({
848
+ return this.emitSync(code, append.appendPath(path, this.entryPath), defu2__default.default({
852
849
  meta: {
853
850
  type: "entry",
854
851
  properties: {
855
- file: entryPath,
852
+ file: append.appendPath(path, this.entryPath),
856
853
  name: options?.name,
857
854
  output: options?.output,
858
855
  "input.file": options?.input?.file,
@@ -1160,7 +1157,7 @@ var PowerlinesContext = class _PowerlinesContext {
1160
1157
  }
1161
1158
  });
1162
1159
  }
1163
- this.config.entry = chunkZQG74VOL_cjs.getUniqueEntries(this.config.entry);
1160
+ this.config.entry = chunk3HKUPTJN_cjs.getUniqueEntries(this.config.entry);
1164
1161
  if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) {
1165
1162
  this.config.name = this.config.name.split("/").filter(Boolean)[1];
1166
1163
  }
@@ -1264,5 +1261,5 @@ exports.isPluginHook = isPluginHook;
1264
1261
  exports.isPluginHookField = isPluginHookField;
1265
1262
  exports.isUnpluginHookField = isUnpluginHookField;
1266
1263
  exports.isUnpluginHookKey = isUnpluginHookKey;
1267
- //# sourceMappingURL=chunk-QOL47PXI.cjs.map
1268
- //# sourceMappingURL=chunk-QOL47PXI.cjs.map
1264
+ //# sourceMappingURL=chunk-M4QQN724.cjs.map
1265
+ //# sourceMappingURL=chunk-M4QQN724.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/helpers/resolver.ts","../../src/types/commands.ts","../../src/types/plugin.ts","../../src/plugin-utils/helpers.ts","../../src/lib/contexts/context.ts"],"names":["resolveOptions","options","defu","interopDefault","fsCache","mode","joinPaths","cacheDir","moduleCache","createPluginResolver","createJiti","workspaceRoot","projectRoot","createResolver","baseResolver","plugin","SUPPORTED_COMMANDS","PLUGIN_NON_HOOK_FIELDS","PLUGIN_HOOKS_FIELDS","BUILDER_VARIANTS","isPlugin","value","isSetObject","isSetString","name","isUndefined","api","applyToEnvironment","isFunction","dedupe","every","hook","isPluginHookFunction","variant","isPluginConfigObject","isPluginConfigTuple","Array","isArray","length","isPluginConfig","item","isPluginHookObject","handler","isPluginHook","getHookHandler","pluginHook","isUnpluginHookKey","keys","UNPLUGIN_BUILDER_VARIANTS","some","startsWith","isPluginHookField","includes","isUnpluginHookField","field","checkDedupe","plugins","p","addPluginHook","context","hooksList","map","filter","Boolean","args","apply","push","findInvalidPluginConfig","config","invalidItems","forEach","invalid","i","JSON","stringify","configCache","WeakMap","envPathCache","agent","Agent","keepAliveTimeout","setGlobalDispatcher","compose","interceptors","retry","maxRetries","minTimeout","maxTimeout","timeoutFactor","retryAfter","PowerlinesContext","uuid","Date","now","build","projectType","type","root","title","organization","compatibilityDate","description","sourceRoot","configFile","customLogger","logLevel","tsconfig","tsconfigRaw","skipCache","autoInstall","entry","output","lint","transform","framework","artifactsPath","dts","builtinPrefix","from","loadWorkspaceConfig","withUserConfig","powerlinesPath","resolvePackage","Error","dependencies","devDependencies","persistedMeta","undefined","packageJson","projectJson","resolver","resolvePatterns","$$internal","_entry","resolveEntriesSync","toArray","tsconfigFilePath","tsconfigPathsToRegExp","paths","fs","VirtualFileSystem","createSync","checksum","meta","buildId","releaseId","timestamp","projectRootHash","murmurhash","workspaceConfig","maxLength","PROJECT_ROOT_HASH_LENGTH","configHash","CACHE_HASH_LENGTH","resolvedConfig","log","logFn","createLog","envPaths","has","get","getEnvPaths","orgId","appId","set","builtinsPath","entryPath","dataPath","data","getPrefixedProjectRootHash","cachePath","cache","dtsPath","appendPath","relativeToWorkspaceRoot","builtins","Object","values","metadata","id","program","createProgram","skipAddingFilesFromTsConfig","parserCache","create","cacheId","ttl","lruSize","persistInterval","requestCache","entries","path","typeDefinition","file","properties","input","fetch","cacheKey","toString","cached","Response","body","status","statusText","headers","response","fetchRequest","timeout","result","text","fromEntries","parse","code","lang","sourceType","showSemanticErrors","resolve","importer","moduleId","alias","find","a","match","replacement","isVirtual","conditions","extensions","external","skipNodeModulesBundle","noExternal","test","load","resolvedId","read","getBuiltins","Promise","all","emit","filePath","extension","findFileExtensionSafe","replace","findFileDotExtensionSafe","emitFile","emitWithBundler","needsCodeReference","originalFileName","fileName","source","write","emitSync","writeSync","emitEntry","omit","emitEntrySync","emitBuiltin","String","emitBuiltinSync","userConfig","isHighPriority","mergeUserConfig","init","withInlineConfig","inlineConfig","command","workspacePackageJsonPath","existsSync","readJsonFile","repository","url","fatal","message","LogLevelLabel","FATAL","isString","StormJSON","error","ERROR","warn","WARN","info","INFO","debug","DEBUG","trace","TRACE","isNull","extendLog","generateChecksum","hashDirectory","ignore","projectJsonPath","packageJsonPath","loadUserConfigFile","getTsconfigFilePath","version","outputPath","directories","assets","glob","platform","preview","environments","babel","presets","eslint","target","override","getUniqueEntries","split","titleCase","author","getUnique","format","buildPath","getUniqueBy","asset","isParentPath","replacePath","reduce","ret","replacePathTokens","polyfill","into"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAASA,eAAeC,OAAAA,EAA8B;AACpD,EAAA,OAAOC,uBAAKD,OAAAA,EAAS;IACnBE,cAAAA,EAAgB,IAAA;AAChBC,IAAAA,OAAAA,EACEH,QAAQI,IAAAA,KAAS,aAAA,GACbC,oBAAUL,OAAAA,CAAQM,QAAAA,EAAU,MAAA,CAAA,GAC5B,KAAA;AACNC,IAAAA,WAAAA,EAAaP,QAAQI,IAAAA,KAAS;GAChC,CAAA;AACF;AATSL,wBAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA;AAiBT,SAASS,qBAAqBR,OAAAA,EAA8B;AAC1D,EAAA,OAAOS,gBACLJ,mBAAAA,CAAUL,OAAAA,CAAQU,eAAeV,OAAAA,CAAQW,WAAW,GACpDZ,cAAAA,CAAe;IACb,GAAGC;AA2FL,GAAA,CAAA,CAAA;AAEJ;AAjGSQ,wBAAAA,CAAAA,oBAAAA,EAAAA,sBAAAA,CAAAA;AAyGF,SAASI,eAAeZ,OAAAA,EAA8B;AAC3D,EAAA,MAAMa,YAAAA,GAAeJ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AAA;AAEAA,MAAAA,GAAAA,CAAI9P,KAAKnD,MAAAA,CAAAA;AAET,MAAA,OAAOiT,GAAAA;AACT,IAAA,CAAA,EAAG,EAAE,CAAA;AACT,EAAA;AACF","file":"chunk-M4QQN724.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { Jiti, JitiOptions, createJiti } from \"jiti\";\nimport { Resolver } from \"../../types/context\";\nimport { ResolvedConfig } from \"../../types/resolved\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Pick<ResolvedConfig, \"mode\" | \"logLevel\" | \"skipCache\"> & {\n workspaceRoot: string;\n projectRoot: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction createPluginResolver(options: CreateResolverOptions): Jiti {\n return createJiti(\n joinPaths(options.workspaceRoot, options.projectRoot),\n resolveOptions({\n ...options\n\n // transform: (params: TransformOptions): TransformResult => {\n // if (!params.filename) {\n // return {\n // code: params.source\n // };\n // }\n\n // const babelOptions = {\n // babelrc: false,\n // configFile: false,\n // compact: false,\n // retainLines: isBoolean(params.retainLines)\n // ? params.retainLines\n // : true,\n // filename: params.filename,\n // plugins: [\n // [\n // transformModuleBabelPlugin,\n // {\n // allowTopLevelThis: true,\n // noInterop: !params.interopDefault,\n // async: params.async\n // }\n // ],\n // [importMetaPathsBabelPlugin, { filename: params.filename }],\n // [importMetaEnvBabelPlugin],\n // [transformMetadataBabelPlugin],\n // [syntaxClassPropertiesPlugin],\n // [transformExportNamespaceFromPlugin]\n // ]\n // } as BabelTransformOptions;\n\n // if (\n // findFileExtension(params.filename) === \"jsx\" ||\n // findFileExtension(params.filename) === \"tsx\"\n // ) {\n // babelOptions.plugins!.push([syntaxJSXPlugin]);\n // babelOptions.plugins!.push([\n // alloyPlugin,\n // {\n // alloyModuleName: \"@alloy-js/core\"\n // }\n // ]);\n // babelOptions.plugins!.push([\n // jsxDomExpressionsPlugin,\n // {\n // alloyModuleName: \"@alloy-js/core\",\n // moduleName: \"@alloy-js/core/jsx-runtime\",\n // generate: \"universal\",\n // wrapConditionals: true,\n // preserveWhitespace: true\n // }\n // ]);\n // }\n\n // if (\n // findFileExtension(params.filename) === \"ts\" ||\n // findFileExtension(params.filename) === \"tsx\"\n // ) {\n // babelOptions.plugins!.push([\n // typescriptPlugin,\n // {\n // allowDeclareFields: true,\n // isTSX: findFileExtension(params.filename) === \"tsx\"\n // }\n // ]);\n\n // babelOptions.plugins!.unshift([transformMetadataBabelPlugin]);\n // babelOptions.plugins!.unshift([\n // proposalDecoratorsPlugin,\n // { legacy: true }\n // ]);\n\n // babelOptions.plugins!.push([parameterDecoratorPlugin]);\n // babelOptions.plugins!.push([syntaxImportAssertionsPlugin]);\n // }\n\n // const result = transformSync(params.source, babelOptions);\n // if (!result?.code) {\n // return {\n // code: params.source,\n // error: new Error(\"Failed to transform source code.\")\n // };\n // }\n\n // return {\n // code: result.code\n // };\n // }\n } as CreateResolverOptions)\n );\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.projectRoot),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createPluginResolver(options);\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"deploy\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\n>;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { AnyFunction, MaybePromise } from \"@stryke/types/base\";\nimport { LoadResult } from \"rollup\";\nimport type { ExternalIdResult, HookFilter, TransformResult } from \"unplugin\";\nimport type { BuilderVariant, UnpluginBuilderVariant } from \"./build\";\nimport { BUILDER_VARIANTS } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport { SUPPORTED_COMMANDS } from \"./commands\";\nimport type { EnvironmentConfig, PluginConfig } from \"./config\";\nimport type {\n BuildPluginContext,\n PluginContext,\n UnresolvedContext\n} from \"./context\";\nimport type { EnvironmentResolvedConfig, ResolvedConfig } from \"./resolved\";\nimport { InferUnpluginOptions } from \"./unplugin\";\n\nexport interface PluginHookObject<\n THookFunction extends AnyFunction,\n TFilter extends keyof HookFilter = never\n> {\n /**\n * The order in which the plugin should be applied.\n */\n order?: \"pre\" | \"post\" | null | undefined;\n\n /**\n * A filter to determine when the hook should be called.\n */\n filter?: Pick<HookFilter, TFilter>;\n\n /**\n * The hook function to be called.\n */\n handler: THookFunction;\n}\n\nexport type PluginHook<\n THookFunction extends AnyFunction,\n TFilter extends keyof HookFilter = never\n> = THookFunction | PluginHookObject<THookFunction, TFilter>;\n\n/**\n * A result returned by the plugin from the `types` hook that describes the declaration types output file.\n */\nexport interface TypesResult {\n directives?: string[];\n code: string;\n}\n\nexport type PluginHookFunctions<TContext extends PluginContext> = {\n [TCommandType in CommandType]: (this: TContext) => MaybePromise<void>;\n} & {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config: (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<DeepPartial<TContext[\"config\"]> & Record<string, any>>;\n\n /**\n * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @remarks\n * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.\n *\n * @see https://vitejs.dev/guide/api-plugin#configenvironment\n *\n * @param this - The build context.\n * @param name - The name of the environment being configured.\n * @param environment - The Vite-like environment object containing information about the current build environment.\n * @returns A promise that resolves when the hook is complete.\n */\n configEnvironment: (\n this: TContext,\n name: string,\n environment: EnvironmentConfig\n ) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;\n\n /**\n * A hook that is called when the plugin is resolved.\n *\n * @see https://vitejs.dev/guide/api-plugin#configresolved\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n configResolved: (this: TContext) => MaybePromise<void>;\n\n /**\n * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.\n *\n * @param this - The build context.\n * @param code - The source code to generate types for.\n * @returns A promise that resolves when the hook is complete.\n */\n types: (\n this: TContext,\n code: string\n ) => MaybePromise<TypesResult | string | undefined | null>;\n\n /**\n * A hook that is called at the start of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildStart: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called at the end of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildEnd: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<LoadResult>;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>;\n\n /**\n * A hook that is called to write the bundle to disk.\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n writeBundle: (this: TContext) => MaybePromise<void>;\n};\n\nexport type PluginHooks<TContext extends PluginContext> = {\n [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<\n PluginHookFunctions<TContext>[TPluginHook]\n >;\n} & {\n transform: PluginHook<\n PluginHookFunctions<TContext>[\"transform\"],\n \"code\" | \"id\"\n >;\n load: PluginHook<PluginHookFunctions<TContext>[\"load\"], \"id\">;\n resolveId: PluginHook<PluginHookFunctions<TContext>[\"resolveId\"], \"id\">;\n};\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type Plugin<\n TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>\n> = Partial<PluginHooks<TContext>> & {\n /**\n * The name of the plugin, for use in deduplication, error messages and logs.\n */\n name: string;\n\n /**\n * An API object that can be used for inter-plugin communication.\n *\n * @see https://rollupjs.org/plugin-development/#direct-plugin-communication\n */\n api?: Record<string, any>;\n\n /**\n * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.\n *\n * @remarks\n * The Plugin invocation order is as follows:\n * - `enforce: 'pre'` plugins\n * - `order: 'pre'` plugin hooks\n * - any other plugins (normal)\n * - `order: 'post'` plugin hooks\n * - `enforce: 'post'` plugins\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering\n * @see https://rollupjs.org/plugin-development/#build-hooks\n * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post\n * @see https://esbuild.github.io/plugins/#concepts\n */\n enforce?: \"pre\" | \"post\";\n\n /**\n * A function to determine if two plugins are the same and can be de-duplicated.\n *\n * @remarks\n * If this is not provided, plugins are de-duplicated by comparing their names.\n *\n * @param other - The other plugin to compare against.\n * @returns `true` if the two plugins are the same, `false` otherwise.\n */\n dedupe?: false | ((other: Plugin<any>) => boolean);\n\n /**\n * A list of pre-requisite plugins that must be loaded before this plugin can be used.\n */\n // dependsOn?: PluginConfig<TContext>[];\n\n /**\n * Define environments where this plugin should be active. By default, the plugin is active in all environments.\n *\n * @param environment - The environment to check.\n * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.\n */\n applyToEnvironment?: (\n environment: EnvironmentResolvedConfig\n ) => boolean | PluginConfig<TContext>;\n\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config?:\n | PluginHook<\n (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<DeepPartial<TContext[\"config\"]> & Record<string, any>>\n >\n | (DeepPartial<TContext[\"config\"]> & Record<string, any>);\n} & {\n [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<\n TContext,\n TBuilderVariant\n >;\n};\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuilderVariant;\n\nexport const PLUGIN_HOOKS_FIELDS = [\n ...SUPPORTED_COMMANDS,\n \"config\",\n \"configEnvironment\",\n \"configResolved\",\n \"types\",\n \"buildStart\",\n \"buildEnd\",\n \"transform\",\n \"load\",\n \"resolveId\",\n \"writeBundle\"\n] as const;\n\nexport type PluginHookFields<TContext extends PluginContext = PluginContext> =\n keyof PluginHookFunctions<TContext>;\n\nexport const KNOWN_PLUGIN_FIELDS = [\n ...PLUGIN_NON_HOOK_FIELDS,\n ...PLUGIN_HOOKS_FIELDS,\n ...BUILDER_VARIANTS\n] as const;\n\nexport type PluginFields = ArrayValues<typeof KNOWN_PLUGIN_FIELDS>;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n BUILDER_VARIANTS,\n UNPLUGIN_BUILDER_VARIANTS,\n UnpluginBuilderVariant\n} from \"../types/build\";\nimport {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple\n} from \"../types/config\";\nimport { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport {\n HookFields,\n PluginHooksListItem,\n UnpluginHooksListItem\n} from \"../types/hooks\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport { ResolvedConfig } from \"../types/resolved\";\nimport { UnpluginOptions } from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n ) &&\n BUILDER_VARIANTS.every(\n variant =>\n isUndefined((value as Plugin<TContext>)[variant]) ||\n (variant in value && isSetObject((value as Plugin<TContext>)[variant]))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> = TField extends PluginHookFields\n ? PluginHooksListItem<TContext, TField>[\"handler\"]\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, TField>[\"handler\"]\n : never;\n\ntype HooksListItemForField<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> =\n TField extends PluginHookFields<TContext>\n ? PluginHooksListItem<TContext, Extract<TField, PluginHookFields<TContext>>>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, Extract<TField, UnpluginBuilderVariant>>\n : never;\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TField> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TField>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n): keys is PluginHookFields<TContext> {\n return (\n !isUnpluginHookKey(keys) &&\n PLUGIN_HOOKS_FIELDS.includes(keys as PluginHookFields<TContext>)\n );\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends PluginHooksListItem<TContext, TField> = PluginHooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n) {\n if (\n !checkDedupe(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as HooksListItemForField<\n TContext,\n TField\n >[\"handler\"];\n if (!handler) {\n return;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { relativeToWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { hashDirectory } from \"@stryke/hash/hash-files\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUnique, getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { fetchRequest } from \"@stryke/http/fetch\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport {\n findFileDotExtensionSafe,\n findFileExtensionSafe\n} from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { TypeDefinition } from \"@stryke/types/configuration\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { match, tsconfigPathsToRegExp } from \"bundle-require\";\nimport defu from \"defu\";\nimport { create, FlatCache } from \"flat-cache\";\nimport { parse, ParseResult } from \"oxc-parser\";\nimport { Range } from \"semver\";\nimport { Project } from \"ts-morph\";\nimport {\n Agent,\n BodyInit,\n interceptors,\n RequestInfo,\n Response,\n setGlobalDispatcher\n} from \"undici\";\nimport {\n ExternalIdResult,\n UnpluginBuildContext,\n UnpluginMessage\n} from \"unplugin\";\nimport {\n createResolver,\n CreateResolverOptions\n} from \"../../internal/helpers/resolver\";\nimport { checkDedupe, isPlugin } from \"../../plugin-utils/helpers\";\nimport { replacePathTokens } from \"../../plugin-utils/paths\";\nimport {\n InitialUserConfig,\n LogFn,\n ParsedUserConfig,\n PluginConfig,\n PowerlinesCommand,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n Context,\n EmitEntryOptions,\n EmitOptions,\n FetchOptions,\n InitContextOptions,\n MetaInfo,\n ParseOptions,\n Resolver,\n TransformResult\n} from \"../../types/context\";\nimport {\n ResolveOptions,\n VirtualFile,\n VirtualFileSystemInterface\n} from \"../../types/fs\";\nimport { UNSAFE_ContextInternal } from \"../../types/internal\";\nimport {\n ResolvedAssetGlob,\n ResolvedConfig,\n ResolvedEntryTypeDefinition\n} from \"../../types/resolved\";\nimport { ParsedTypeScriptConfig } from \"../../types/tsconfig\";\nimport { loadUserConfigFile, loadWorkspaceConfig } from \"../config-file\";\nimport { getUniqueEntries, resolveEntriesSync } from \"../entry\";\nimport { VirtualFileSystem } from \"../fs/vfs\";\nimport { createLog, extendLog } from \"../logger\";\nimport { createProgram } from \"../typescript/ts-morph\";\nimport { getTsconfigFilePath } from \"../typescript/tsconfig\";\nimport {\n CACHE_HASH_LENGTH,\n getPrefixedProjectRootHash,\n PROJECT_ROOT_HASH_LENGTH\n} from \"../utilities/meta\";\n\ninterface ConfigCacheKey {\n projectRoot: string;\n mode: \"test\" | \"development\" | \"production\";\n skipCache: boolean;\n configFile?: string;\n framework: string;\n command?: string;\n}\n\ninterface ConfigCacheResult {\n projectJson: Context[\"projectJson\"];\n packageJson: Context[\"packageJson\"];\n checksum: string;\n resolver: Resolver;\n userConfig: ParsedUserConfig;\n}\n\nconst configCache = new WeakMap<ConfigCacheKey, ConfigCacheResult>();\n\ninterface EnvPathCacheKey {\n framework: string;\n workspaceRoot: string;\n}\n\nconst envPathCache = new WeakMap<EnvPathCacheKey, EnvPaths>();\n\nconst agent = new Agent({ keepAliveTimeout: 10000 });\nsetGlobalDispatcher(\n agent.compose(\n interceptors.retry({\n maxRetries: 3,\n minTimeout: 1000,\n maxTimeout: 10000,\n timeoutFactor: 2,\n retryAfter: true\n })\n )\n);\n\nexport class PowerlinesContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n> implements Context<TResolvedConfig> {\n /**\n * Internal references storage\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n #internal = {} as UNSAFE_ContextInternal<TResolvedConfig>;\n\n #workspaceConfig: WorkspaceConfig;\n\n #checksum: string | null = null;\n\n #buildId: string = uuid();\n\n #releaseId: string = uuid();\n\n #timestamp: number = Date.now();\n\n #fs!: VirtualFileSystemInterface;\n\n #tsconfig!: ParsedTypeScriptConfig;\n\n #program!: Project;\n\n #parserCache!: FlatCache;\n\n #requestCache!: FlatCache;\n\n #getConfigProps(config: Partial<TResolvedConfig[\"userConfig\"]> = {}) {\n return defu(\n {\n variant: config.build?.variant,\n projectType: config.type,\n projectRoot: config.root,\n name: config.name,\n title: config.title,\n organization: config.organization,\n compatibilityDate: config.compatibilityDate,\n description: config.description,\n sourceRoot: config.sourceRoot,\n configFile: config.configFile,\n customLogger: config.customLogger,\n logLevel: config.logLevel,\n tsconfig: config.tsconfig,\n tsconfigRaw: config.tsconfigRaw,\n skipCache: config.skipCache,\n autoInstall: config.autoInstall,\n entry: config.entry,\n output: config.output,\n plugins: config.plugins,\n mode: config.mode,\n lint: config.lint,\n transform: config.transform,\n build: config.build,\n framework: config.framework,\n ...config\n },\n {\n output: config.framework\n ? {\n artifactsPath: `.${config.framework ?? \"powerlines\"}`,\n dts: joinPaths(\n config.root ?? this.config.projectRoot,\n `${config.framework ?? \"powerlines\"}.d.ts`\n ),\n builtinPrefix: config.framework ?? \"powerlines\"\n }\n : {}\n }\n );\n }\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<Context> {\n const context = new PowerlinesContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * An object containing the dependencies that should be installed for the project\n */\n public dependencies: Record<string, string | Range> = {};\n\n /**\n * An object containing the development dependencies that should be installed for the project\n */\n public devDependencies: Record<string, string | Range> = {};\n\n /**\n * The persisted meta information about the current build\n */\n public persistedMeta: MetaInfo | undefined = undefined;\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The resolved configuration options\n */\n private resolvePatterns: RegExp[] = [];\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return this.#internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public set $$internal(value: UNSAFE_ContextInternal<TResolvedConfig>) {\n this.#internal = value;\n }\n\n /**\n * The resolved entry type definitions for the project\n */\n public get entry(): ResolvedEntryTypeDefinition[] {\n const entry = this._entry;\n\n return resolveEntriesSync(\n this,\n !entry || entry.length === 0 ? toArray(this.config.entry) : entry\n );\n }\n\n /**\n * The TypeScript configuration parsed from the tsconfig file\n */\n public get tsconfig(): ParsedTypeScriptConfig {\n if (!this.#tsconfig) {\n this.tsconfig = {\n tsconfigFilePath: this.config.tsconfig\n } as ParsedTypeScriptConfig;\n }\n\n return this.#tsconfig;\n }\n\n /**\n * Sets the TypeScript configuration parsed from the tsconfig file\n */\n public set tsconfig(value: ParsedTypeScriptConfig) {\n this.#tsconfig = value;\n this.resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});\n }\n\n /**\n * The virtual file system interface for the project\n */\n public get fs(): VirtualFileSystemInterface {\n if (!this.#fs) {\n this.#fs = VirtualFileSystem.createSync(this);\n }\n\n return this.#fs;\n }\n\n /**\n * Get the checksum of the project's current state\n */\n public get checksum(): string | null {\n return this.#checksum;\n }\n\n /**\n * The meta information about the current build\n */\n public get meta() {\n return {\n buildId: this.#buildId,\n releaseId: this.#releaseId,\n checksum: this.#checksum,\n timestamp: this.#timestamp,\n projectRootHash: murmurhash(\n {\n workspaceRoot: this.workspaceConfig?.workspaceRoot,\n projectRoot: this.config?.projectRoot\n },\n {\n maxLength: PROJECT_ROOT_HASH_LENGTH\n }\n ),\n configHash: murmurhash(this.config, {\n maxLength: CACHE_HASH_LENGTH\n })\n } as MetaInfo;\n }\n\n /**\n * The resolved configuration options\n */\n public get config(): TResolvedConfig {\n return this.resolvedConfig ?? {};\n }\n\n /**\n * The logger function\n */\n public get log(): LogFn {\n if (!this.logFn) {\n this.logFn = this.createLog();\n }\n\n return this.logFn;\n }\n\n /**\n * The workspace configuration\n */\n public get workspaceConfig(): WorkspaceConfig {\n return this.#workspaceConfig;\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n if (\n envPathCache.has({\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n framework: this.config?.framework || \"powerlines\"\n })\n ) {\n return envPathCache.get({\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n framework: this.config?.framework || \"powerlines\"\n })!;\n }\n\n const envPaths = getEnvPaths({\n orgId: \"storm-software\",\n appId: this.config?.framework || \"powerlines\",\n workspaceRoot: this.workspaceConfig.workspaceRoot\n });\n envPathCache.set(\n {\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n framework: this.config?.framework || \"powerlines\"\n },\n envPaths\n );\n\n return envPaths;\n }\n\n /**\n * Get the path to the artifacts directory for the project\n */\n public get artifactsPath(): string {\n return joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot,\n this.config.output.artifactsPath\n );\n }\n\n /**\n * Get the path to the builtin modules used by the project\n */\n public get builtinsPath(): string {\n return joinPaths(this.artifactsPath, \"builtins\");\n }\n\n /**\n * Get the path to the entry directory for the project\n */\n public get entryPath(): string {\n return joinPaths(this.artifactsPath, \"entry\");\n }\n\n /**\n * Get the path to the data directory for the project\n */\n public get dataPath(): string {\n return joinPaths(\n this.envPaths.data,\n \"projects\",\n getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash)\n );\n }\n\n /**\n * Get the path to the cache directory for the project\n */\n public get cachePath(): string {\n return joinPaths(\n this.envPaths.cache,\n \"projects\",\n murmurhash(\n {\n checksum: this.#checksum,\n config: this.meta.configHash\n },\n {\n maxLength: CACHE_HASH_LENGTH\n }\n )\n );\n }\n\n /**\n * Get the path to the generated declaration file for the project\n */\n public get dtsPath(): string {\n return this.config.output.dts\n ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot)\n : joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot,\n \"powerlines.d.ts\"\n );\n }\n\n /**\n * Get the project root relative to the workspace root\n */\n public get relativeToWorkspaceRoot() {\n return relativeToWorkspaceRoot(this.config.projectRoot);\n }\n\n /**\n * The builtin module id that exist in the Powerlines virtual file system\n */\n public get builtins(): string[] {\n return Object.values(this.fs.metadata)\n .filter(meta => meta && meta.type === \"builtin\")\n .map(meta => meta?.id)\n .filter(Boolean);\n }\n\n /**\n * The {@link Project} instance used for type reflection and module manipulation\n *\n * @see https://ts-morph.com/\n *\n * @remarks\n * This instance is created lazily on first access.\n */\n public get program(): Project {\n if (!this.#program) {\n this.#program = createProgram(this, {\n skipAddingFilesFromTsConfig: true\n });\n }\n\n return this.#program;\n }\n\n /**\n * Gets the parser cache.\n */\n protected get parserCache(): FlatCache {\n if (!this.#parserCache) {\n this.#parserCache = create({\n cacheId: \"parser\",\n cacheDir: this.cachePath,\n ttl: 2 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#parserCache;\n }\n\n /**\n * Gets the request cache.\n */\n protected get requestCache(): FlatCache {\n if (!this.#requestCache) {\n this.#requestCache = create({\n cacheId: \"http\",\n cacheDir: this.cachePath,\n ttl: 6 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#requestCache;\n }\n\n /**\n * The entry points that exist in the Powerlines virtual file system\n */\n protected get _entry(): ResolvedEntryTypeDefinition[] {\n return Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"entry\")\n .map(([path, meta]) => {\n const typeDefinition = {\n file: path\n } as ResolvedEntryTypeDefinition;\n\n if (meta.properties) {\n if (isSetString(meta.properties.name)) {\n typeDefinition.name = meta.properties.name;\n }\n if (\n isSetString(meta.properties[\"input.file\"]) ||\n isSetString(meta.properties[\"input.name\"])\n ) {\n typeDefinition.input ??= {} as TypeDefinition;\n if (isSetString(meta.properties[\"input.file\"])) {\n typeDefinition.input.file = meta.properties[\"input.file\"];\n }\n if (isSetString(meta.properties[\"input.name\"])) {\n typeDefinition.input.name = meta.properties[\"input.name\"];\n }\n }\n if (isSetString(meta.properties.output)) {\n typeDefinition.output = meta.properties.output;\n }\n }\n\n return typeDefinition;\n })\n .filter(Boolean);\n }\n\n /**\n * A function to perform HTTP fetch requests\n *\n * @remarks\n * This function uses a caching layer to avoid duplicate requests during the Powerlines process.\n *\n * @example\n * ```ts\n * const response = await context.fetch(\"https://api.example.com/data\");\n * const data = await response.json();\n * ```\n *\n * @see https://github.com/nodejs/undici\n *\n * @param input - The URL to fetch.\n * @param options - The fetch request options.\n * @returns A promise that resolves to a response returned by the fetch.\n */\n public async fetch(\n input: RequestInfo,\n options: FetchOptions = {}\n ): Promise<Response> {\n const cacheKey = murmurhash({\n input: input.toString(),\n options: JSON.stringify(options)\n });\n\n if (!this.config.skipCache && !options.skipCache) {\n const cached = this.requestCache.get<\n {\n body: BodyInit;\n } & Pick<Response, \"status\" | \"statusText\" | \"headers\">\n >(cacheKey);\n if (cached) {\n return new Response(cached.body, {\n status: cached.status,\n statusText: cached.statusText,\n headers: cached.headers\n });\n }\n }\n\n const response = await fetchRequest(input, { timeout: 12_000, ...options });\n const result = {\n body: await response.text(),\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.entries())\n };\n\n if (!this.config.skipCache && !options.skipCache) {\n try {\n this.requestCache.set(cacheKey, result);\n } catch {\n // Do nothing\n }\n }\n\n return new Response(result.body, {\n status: result.status,\n statusText: result.statusText,\n headers: result.headers\n });\n }\n\n /**\n * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.\n *\n * @remarks\n * This function can be used to parse TypeScript code into an AST for further analysis or transformation.\n *\n * @example\n * ```ts\n * const ast = context.parse(\"const x: number = 42;\");\n * ```\n *\n * @see https://rollupjs.org/plugin-development/#this-parse\n * @see https://github.com/oxc/oxc\n *\n * @param code - The source code to parse.\n * @param options - The options to pass to the parser.\n * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.\n */\n public async parse(code: string, options: ParseOptions = {}) {\n const cacheKey = murmurhash({\n code,\n options\n });\n\n let result!: ParseResult;\n if (!this.config.skipCache) {\n result = this.parserCache.get<ParseResult>(cacheKey);\n if (result) {\n return result;\n }\n }\n\n result = await parse(`source.${options.lang || \"ts\"}`, code, {\n ...options,\n sourceType: \"module\",\n showSemanticErrors: this.config.mode === \"development\"\n });\n\n if (!this.config.skipCache) {\n this.parserCache.set(cacheKey, result);\n }\n\n return result;\n }\n\n /**\n * A helper function to resolve modules in the Virtual File System\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolved = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n public async resolve(\n id: string,\n importer?: string,\n options: ResolveOptions = {}\n ): Promise<ExternalIdResult | undefined> {\n let moduleId = id;\n if (this.config.build.alias) {\n if (Array.isArray(this.config.build.alias)) {\n const alias = this.config.build.alias.find(a =>\n match(moduleId, [a.find])\n );\n if (alias) {\n moduleId = alias.replacement;\n }\n } else if (\n isSetObject(this.config.build.alias) &&\n this.config.build.alias[id]\n ) {\n moduleId = this.config.build.alias[id];\n }\n }\n\n if (this.fs.isVirtual(moduleId)) {\n const result = await this.fs.resolve(moduleId, importer, {\n conditions: this.config.build.conditions,\n extensions: this.config.build.extensions,\n ...options\n });\n if (!result) {\n return undefined;\n }\n\n return {\n id: `\\0${result}`,\n external: this.config.projectType !== \"application\"\n };\n }\n\n if (this.config.build.skipNodeModulesBundle) {\n if (\n match(moduleId, this.resolvePatterns) ||\n match(moduleId, this.config.build.noExternal)\n ) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.build.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true };\n }\n\n // Exclude any other import that looks like a Node module\n if (!/^[A-Z]:[/\\\\]|^\\.{0,2}\\/|^\\.{1,2}$/.test(moduleId)) {\n return {\n id: moduleId,\n external: true\n };\n }\n } else {\n if (match(moduleId, this.config.build.noExternal)) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.build.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true };\n }\n }\n\n return undefined;\n }\n\n /**\n * A helper function to load modules from the Virtual File System\n *\n * @remarks\n * This function can be used to load modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const module = await context.load(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to load.\n * @returns A promise that resolves to the loaded module.\n */\n public async load(id: string): Promise<TransformResult | undefined> {\n const resolvedId = await this.fs.resolve(id);\n if (!resolvedId) {\n return undefined;\n }\n\n const code = await this.fs.read(resolvedId);\n if (!code) {\n return undefined;\n }\n\n return { code, map: null };\n }\n\n /**\n * Get the builtin virtual files that exist in the Powerlines virtual file system\n */\n public async getBuiltins() {\n return Promise.all(\n Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"builtin\")\n .map(async ([path, meta]) => {\n const code = await this.fs.read(path);\n\n return { ...meta, path, code } as VirtualFile;\n })\n );\n }\n\n /**\n * Resolves a file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the file\n * @param path - The path to write the file to\n * @param options - Additional options for writing the file\n */\n public async emit(\n code: string,\n path: string,\n options: EmitOptions = {}\n ): Promise<void> {\n const filePath = options.extension\n ? findFileExtensionSafe(path)\n ? options.extension.startsWith(\".\")\n ? path.replace(findFileDotExtensionSafe(path), options.extension)\n : path.replace(findFileExtensionSafe(path), options.extension)\n : options.extension.startsWith(\".\")\n ? `${path}${options.extension}`\n : `${path}.${options.extension}`\n : findFileExtensionSafe(path)\n ? path\n : `${path}.ts`;\n\n if (\n isFunction((this as unknown as UnpluginBuildContext).emitFile) &&\n options.emitWithBundler\n ) {\n return (this as unknown as UnpluginBuildContext).emitFile({\n needsCodeReference: options.needsCodeReference,\n originalFileName: options.originalFileName,\n fileName: filePath,\n source: code,\n type: \"asset\"\n });\n }\n\n return this.fs.write(filePath, code, options);\n }\n\n /**\n * Synchronously resolves a file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the file\n * @param path - The path to write the file to\n * @param options - Additional options for writing the file\n */\n public emitSync(code: string, path: string, options: EmitOptions = {}) {\n const filePath = options.extension\n ? findFileExtensionSafe(path)\n ? options.extension.startsWith(\".\")\n ? path.replace(findFileDotExtensionSafe(path), options.extension)\n : path.replace(findFileExtensionSafe(path), options.extension)\n : options.extension.startsWith(\".\")\n ? `${path}${options.extension}`\n : `${path}.${options.extension}`\n : findFileExtensionSafe(path)\n ? path\n : `${path}.ts`;\n\n if (\n isFunction((this as unknown as UnpluginBuildContext).emitFile) &&\n options.emitWithBundler\n ) {\n return (this as unknown as UnpluginBuildContext).emitFile({\n needsCodeReference: options.needsCodeReference,\n originalFileName: options.originalFileName,\n fileName: filePath,\n source: code,\n type: \"asset\"\n });\n }\n\n return this.fs.writeSync(filePath, code, options);\n }\n\n /**\n * Resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public async emitEntry(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): Promise<void> {\n return this.emit(\n code,\n appendPath(path, this.entryPath),\n defu(\n {\n meta: {\n type: \"entry\",\n properties: {\n file: appendPath(path, this.entryPath),\n name: options?.name,\n output: options?.output,\n \"input.file\": options?.input?.file,\n \"input.name\": options?.input?.name\n }\n }\n },\n omit(options, [\"name\"])\n )\n );\n }\n\n /**\n * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public emitEntrySync(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): void {\n return this.emitSync(\n code,\n appendPath(path, this.entryPath),\n defu(\n {\n meta: {\n type: \"entry\",\n properties: {\n file: appendPath(path, this.entryPath),\n name: options?.name,\n output: options?.output,\n \"input.file\": options?.input?.file,\n \"input.name\": options?.input?.name\n }\n }\n },\n omit(options, [\"name\"])\n )\n );\n }\n\n /**\n * Resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public async emitBuiltin(\n code: string,\n id: string,\n options: EmitOptions = {}\n ): Promise<void> {\n if (!this.builtinsPath) {\n throw new Error(\n `The builtins path is not set. Cannot emit builtin file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The builtin id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emit(\n code,\n appendPath(id, this.builtinsPath),\n defu(options, { meta: { type: \"builtin\", id } })\n );\n }\n\n /**\n * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public emitBuiltinSync(code: string, id: string, options: EmitOptions = {}) {\n if (!this.builtinsPath) {\n throw new Error(\n `The builtins path is not set. Cannot emit builtin file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The builtin id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emitSync(\n code,\n appendPath(id, this.builtinsPath),\n defu(options, { meta: { type: \"builtin\", id } })\n );\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n this.mergeUserConfig(userConfig as Partial<TResolvedConfig[\"userConfig\"]>);\n\n await this.init(this.config.userConfig, options);\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n this.config.inlineConfig = inlineConfig;\n\n if (inlineConfig.command === \"new\") {\n const workspacePackageJsonPath = joinPaths(\n this.workspaceConfig.workspaceRoot,\n \"package.json\"\n );\n if (!existsSync(workspacePackageJsonPath)) {\n throw new Error(\n `The workspace package.json file could not be found at ${workspacePackageJsonPath}`\n );\n }\n\n this.packageJson = await readJsonFile<PackageJson>(\n workspacePackageJsonPath\n );\n\n this.workspaceConfig.repository ??= isSetString(\n this.packageJson?.repository\n )\n ? this.packageJson.repository\n : this.packageJson?.repository?.url;\n }\n\n await this.init(this.config.inlineConfig, options);\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.FATAL,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.ERROR,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.WARN,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.INFO,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.DEBUG,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.TRACE,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * Create a new logger instance\n *\n * @param name - The name to use for the logger instance\n * @returns A logger function\n */\n public createLog(name: string | null = null): LogFn {\n return createLog(name, {\n ...this.config,\n logLevel: isNull(this.config.logLevel) ? \"silent\" : this.config.logLevel\n });\n }\n\n /**\n * Extend the current logger instance with a new name\n *\n * @param name - The name to use for the extended logger instance\n * @returns A logger function\n */\n public extendLog(name: string): LogFn {\n return extendLog(this.log, name);\n }\n\n /**\n * Generates a checksum representing the current context state\n *\n * @param root - The root directory of the project to generate the checksum for\n * @returns A promise that resolves to a string representing the checksum\n */\n public async generateChecksum(\n root = this.config.projectRoot\n ): Promise<string> {\n this.#checksum = await hashDirectory(root, {\n ignore: [\"node_modules\", \".git\", \".nx\", \".cache\", \".storm\", \"tmp\", \"dist\"]\n });\n\n return this.#checksum;\n }\n\n /**\n * Creates a new StormContext instance.\n *\n * @param workspaceConfig - The workspace configuration.\n */\n protected constructor(workspaceConfig: WorkspaceConfig) {\n this.#workspaceConfig = workspaceConfig;\n\n envPathCache.set(\n {\n workspaceRoot: workspaceConfig.workspaceRoot,\n framework: \"powerlines\"\n },\n getEnvPaths({\n orgId:\n (isSetObject(workspaceConfig.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig.organization) || \"storm-software\",\n appId: \"powerlines\",\n workspaceRoot: workspaceConfig.workspaceRoot\n })\n );\n }\n\n /**\n * The resolved configuration for this context\n */\n protected resolvedConfig: TResolvedConfig = {} as TResolvedConfig;\n\n /**\n * A logger function specific to this context\n */\n protected logFn!: LogFn;\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {},\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n const cacheKey: ConfigCacheKey = {\n projectRoot:\n config.root ??\n this.config.projectRoot ??\n this.config.userConfig?.root ??\n this.config.inlineConfig?.root,\n mode: (config.mode ?? this.config.mode) || this.workspaceConfig.mode,\n skipCache: config.skipCache ?? this.config.skipCache ?? false,\n configFile: config.configFile ?? this.config.configFile,\n framework: config.framework ?? this.config.framework ?? \"powerlines\",\n command: this.config.inlineConfig?.command\n };\n\n if (configCache.has(cacheKey)) {\n const result = configCache.get(cacheKey)!;\n\n this.projectJson = result.projectJson;\n this.packageJson = result.packageJson;\n this.#checksum = result.checksum;\n this.resolver = result.resolver;\n\n this.mergeUserConfig(result.userConfig.config, this.config.userConfig);\n } else {\n const projectJsonPath = joinPaths(cacheKey.projectRoot, \"project.json\");\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(cacheKey.projectRoot, \"package.json\");\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n }\n\n this.#checksum = await this.generateChecksum(cacheKey.projectRoot);\n this.resolver = createResolver({\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n projectRoot: cacheKey.projectRoot,\n cacheDir: this.cachePath,\n mode: cacheKey.mode,\n logLevel: (config.logLevel ||\n this.config?.logLevel ||\n this.workspaceConfig.logLevel ||\n \"info\") as CreateResolverOptions[\"logLevel\"],\n skipCache: cacheKey.skipCache\n });\n\n const userConfig = await loadUserConfigFile(\n cacheKey.projectRoot,\n this.workspaceConfig.workspaceRoot,\n this.resolver,\n cacheKey.command as PowerlinesCommand | undefined,\n cacheKey.mode,\n cacheKey.configFile,\n cacheKey.framework\n );\n this.mergeUserConfig(userConfig.config);\n\n configCache.set(cacheKey, {\n projectJson: this.projectJson,\n packageJson: this.packageJson,\n checksum: this.#checksum,\n resolver: this.resolver,\n userConfig\n });\n }\n\n config.tsconfig ??= getTsconfigFilePath(\n this.workspaceConfig.workspaceRoot,\n cacheKey.projectRoot,\n config.tsconfig\n );\n\n if (isSetObject(config)) {\n this.resolvedConfig = defu(\n {\n inlineConfig: this.config.inlineConfig,\n userConfig: this.config.userConfig\n },\n options.isHighPriority ? this.#getConfigProps(config) : {},\n {\n command: this.config.inlineConfig?.command,\n ...this.#getConfigProps(this.config.inlineConfig)\n },\n this.#getConfigProps(this.config.userConfig),\n {\n mode: this.workspaceConfig?.mode,\n logLevel: this.workspaceConfig?.logLevel,\n skipCache: this.workspaceConfig?.skipCache\n },\n {\n name: this.projectJson?.name || this.packageJson?.name,\n version: this.packageJson?.version,\n description: this.packageJson?.description,\n sourceRoot:\n this.projectJson?.sourceRoot ||\n appendPath(\"src\", cacheKey.projectRoot),\n output: defu(config.output ?? {}, {\n outputPath: cacheKey.projectRoot\n ? joinPaths(\n this.workspaceConfig?.directories?.build || \"dist\",\n cacheKey.projectRoot\n )\n : this.workspaceConfig?.directories?.build || \"dist\",\n artifactsPath: `.${config.framework ?? \"powerlines\"}`,\n dts: joinPaths(\n cacheKey.projectRoot,\n `${config.framework ?? \"powerlines\"}.d.ts`\n ),\n builtinPrefix: config.framework ?? \"powerlines\",\n assets: [\n {\n glob: \"LICENSE\"\n },\n {\n input: cacheKey.projectRoot,\n glob: \"*.md\"\n },\n {\n input: cacheKey.projectRoot,\n glob: \"package.json\"\n }\n ]\n })\n },\n options.isHighPriority ? {} : this.#getConfigProps(config),\n {\n inlineConfig: {},\n userConfig: {},\n framework: \"powerlines\",\n platform: \"neutral\",\n mode: \"production\",\n projectType: \"application\",\n logLevel: \"info\",\n preview: false,\n environments: {},\n transform: {\n babel: {\n plugins: [],\n presets: []\n }\n },\n lint: {\n eslint: {}\n },\n build: {\n target: \"esnext\",\n override: {}\n }\n }\n ) as any;\n }\n\n this.config.entry = getUniqueEntries(this.config.entry);\n\n if (\n this.config.name?.startsWith(\"@\") &&\n this.config.name.split(\"/\").filter(Boolean).length > 1\n ) {\n this.config.name = this.config.name.split(\"/\").filter(Boolean)[1]!;\n }\n\n this.config.title ??= titleCase(this.config.name);\n\n this.config.organization ??=\n (isSetObject(this.workspaceConfig.organization)\n ? this.workspaceConfig.organization.name\n : this.workspaceConfig.organization) ||\n (isSetObject(this.packageJson?.author)\n ? this.packageJson?.author?.name\n : this.packageJson?.author) ||\n this.config.name;\n\n if (this.config.userConfig.build?.external) {\n this.config.userConfig.build.external = getUnique(\n this.config.userConfig.build.external\n );\n }\n if (this.config.userConfig.build?.noExternal) {\n this.config.userConfig.build.noExternal = getUnique(\n this.config.userConfig.build.noExternal\n );\n }\n\n if (this.config.build.external) {\n this.config.build.external = getUnique(this.config.build.external);\n }\n if (this.config.build.noExternal) {\n this.config.build.noExternal = getUnique(this.config.build.noExternal);\n }\n\n this.config.output.format = getUnique(\n toArray(\n this.config.output?.format ??\n (this.config.projectType === \"library\" ? [\"cjs\", \"esm\"] : [\"esm\"])\n )\n );\n\n if (\n this.config.projectRoot &&\n this.config.projectRoot !== \".\" &&\n this.config.projectRoot !== \"./\" &&\n this.config.projectRoot !== this.workspaceConfig.workspaceRoot\n ) {\n this.config.output.outputPath ??= joinPaths(\n \"dist\",\n this.config.projectRoot\n );\n this.config.output.buildPath ??= joinPaths(\n this.config.projectRoot,\n \"dist\"\n );\n } else {\n this.config.output.outputPath ??= \"dist\";\n this.config.output.buildPath ??= \"dist\";\n }\n\n this.config.output.assets = getUniqueBy(\n this.config.output.assets.map(asset => {\n return {\n glob: isSetObject(asset) ? asset.glob : asset,\n input:\n isString(asset) ||\n !asset.input ||\n asset.input === \".\" ||\n asset.input === \"/\" ||\n asset.input === \"./\"\n ? this.workspaceConfig.workspaceRoot\n : isParentPath(asset.input, this.workspaceConfig.workspaceRoot) ||\n asset.input === this.workspaceConfig.workspaceRoot\n ? asset.input\n : appendPath(asset.input, this.workspaceConfig.workspaceRoot),\n output:\n isSetObject(asset) && asset.output\n ? isParentPath(asset.output, this.workspaceConfig.workspaceRoot)\n ? asset.output\n : appendPath(\n joinPaths(\n this.config.output.outputPath,\n replacePath(\n replacePath(\n asset.output,\n replacePath(\n this.config.output.outputPath,\n this.workspaceConfig.workspaceRoot\n )\n ),\n this.config.output.outputPath\n )\n ),\n this.workspaceConfig.workspaceRoot\n )\n : appendPath(\n this.config.output.outputPath,\n this.workspaceConfig.workspaceRoot\n ),\n ignore:\n isSetObject(asset) && asset.ignore\n ? toArray(asset.ignore)\n : undefined\n };\n }),\n (a: ResolvedAssetGlob) => `${a.input}-${a.glob}-${a.output}`\n );\n\n this.config.plugins = (this.config.plugins ?? [])\n .filter(Boolean)\n .reduce((ret, plugin) => {\n if (\n isPlugin(plugin) &&\n checkDedupe(\n plugin,\n ret.filter(p => isPlugin(p))\n )\n ) {\n return ret;\n }\n\n ret.push(plugin);\n\n return ret;\n }, [] as PluginConfig[]);\n\n // Apply path token replacements\n\n if (this.config.tsconfig) {\n this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);\n }\n\n if (this.config.output.dts) {\n if (isSetString(this.config.output.dts)) {\n this.config.output.dts = replacePathTokens(\n this,\n this.config.output.dts\n );\n } else {\n this.config.output.dts = joinPaths(\n this.config.projectRoot,\n `${this.config.framework ?? \"powerlines\"}.d.ts`\n );\n }\n }\n\n if (this.config.build.polyfill) {\n this.config.build.polyfill = this.config.build.polyfill.map(polyfill =>\n replacePathTokens(this, polyfill)\n );\n }\n\n if (this.config.output.assets) {\n this.config.output.assets = this.config.output.assets.map(asset => ({\n ...asset,\n glob: replacePathTokens(this, asset.glob),\n ignore: asset.ignore\n ? asset.ignore.map(ignore => replacePathTokens(this, ignore))\n : undefined,\n input: replacePathTokens(this, asset.input),\n output: replacePathTokens(this, asset.output)\n }));\n }\n\n this.#fs ??= await VirtualFileSystem.create(this);\n }\n\n protected mergeUserConfig(\n from: Partial<TResolvedConfig[\"userConfig\"]> = {},\n into: Partial<TResolvedConfig[\"userConfig\"]> = this.config.userConfig ?? {}\n ) {\n this.config.userConfig = defu(\n {\n entry:\n Array.isArray(from.entry) && from.entry.length > 0\n ? from.entry\n : Array.isArray(into?.entry) && into.entry.length > 0\n ? into.entry\n : []\n },\n omit(from ?? {}, [\"entry\"]),\n omit(into ?? {}, [\"entry\"])\n ) as TResolvedConfig[\"userConfig\"];\n\n if (this.config.userConfig.output?.format) {\n this.config.userConfig.output.format = getUnique(\n toArray(this.config.userConfig.output?.format)\n );\n }\n\n this.config.userConfig.plugins = (this.config.userConfig.plugins ?? [])\n .filter(Boolean)\n .reduce((ret, plugin) => {\n if (\n isPlugin(plugin) &&\n checkDedupe(\n plugin,\n ret.filter(p => isPlugin(p))\n )\n ) {\n return ret;\n }\n\n ret.push(plugin);\n\n return ret;\n }, [] as PluginConfig[]);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkGKUDVJPX_cjs = require('./chunk-GKUDVJPX.cjs');
3
+ var chunkRK5MATYS_cjs = require('./chunk-RK5MATYS.cjs');
4
4
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
5
5
  var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
6
6
  var isSetString = require('@stryke/type-checks/is-set-string');
@@ -12,7 +12,7 @@ async function resolve(context, type, overrides = {}) {
12
12
  } else {
13
13
  typeDefinition = type;
14
14
  }
15
- const result = await chunkGKUDVJPX_cjs.bundle(context, typeDefinition.file, overrides);
15
+ const result = await chunkRK5MATYS_cjs.bundle(context, typeDefinition.file, overrides);
16
16
  const resolved = await context.resolver.evalModule(result.text, {
17
17
  filename: result.path,
18
18
  forceTranspile: true
@@ -26,5 +26,5 @@ async function resolve(context, type, overrides = {}) {
26
26
  chunkPK6SKIKE_cjs.__name(resolve, "resolve");
27
27
 
28
28
  exports.resolve = resolve;
29
- //# sourceMappingURL=chunk-AX3FBF6F.cjs.map
30
- //# sourceMappingURL=chunk-AX3FBF6F.cjs.map
29
+ //# sourceMappingURL=chunk-PX45HDHT.cjs.map
30
+ //# sourceMappingURL=chunk-PX45HDHT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/utilities/resolve.ts"],"names":["resolve","context","type","overrides","typeDefinition","isSetString","parseTypeDefinition","result","bundle","file","resolved","resolver","evalModule","text","filename","path","forceTranspile","exportName","name"],"mappings":";;;;;;;AAoCA,eAAsBA,OAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,IAAIC,cAAAA;AACJ,EAAA,IAAIC,uBAAAA,CAAYH,IAAAA,CAAAA,EAAO;AACrBE,IAAAA,cAAAA,GAAiBE,wCAAoBJ,IAAAA,CAAAA;EACvC,CAAA,MAAO;AACLE,IAAAA,cAAAA,GAAiBF,IAAAA;AACnB,EAAA;AAEA,EAAA,MAAMK,SAAS,MAAMC,wBAAAA,CAAOP,OAAAA,EAASG,cAAAA,CAAeK,MAAMN,SAAAA,CAAAA;AAE1D,EAAA,MAAMO,WAAY,MAAMT,OAAAA,CAAQU,QAAAA,CAASC,UAAAA,CAAWL,OAAOM,IAAAA,EAAM;AAC/DC,IAAAA,QAAAA,EAAUP,MAAAA,CAAOQ,IAAAA;IACjBC,cAAAA,EAAgB;GAClB,CAAA;AAEA,EAAA,IAAIC,aAAab,cAAAA,CAAec,IAAAA;AAChC,EAAA,IAAI,CAACD,UAAAA,EAAY;AACfA,IAAAA,UAAAA,GAAa,SAAA;AACf,EAAA;AAEA,EAAA,OAAOP,SAASO,UAAAA,CAAAA,IAAeP,QAAAA,CAAS,CAAA,QAAA,EAAMO,UAAAA,CAAAA,CAAY,CAAA;AAC5D;AAzBsBjB,wBAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-AX3FBF6F.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { bundle } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult = any>(\n context: Context,\n type: TypeDefinitionParameter,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n const resolved = (await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n })) as Record<string, any>;\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n return resolved[exportName] ?? resolved[`__Ω${exportName}`];\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/utilities/resolve.ts"],"names":["resolve","context","type","overrides","typeDefinition","isSetString","parseTypeDefinition","result","bundle","file","resolved","resolver","evalModule","text","filename","path","forceTranspile","exportName","name"],"mappings":";;;;;;;AAoCA,eAAsBA,OAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,IAAIC,cAAAA;AACJ,EAAA,IAAIC,uBAAAA,CAAYH,IAAAA,CAAAA,EAAO;AACrBE,IAAAA,cAAAA,GAAiBE,wCAAoBJ,IAAAA,CAAAA;EACvC,CAAA,MAAO;AACLE,IAAAA,cAAAA,GAAiBF,IAAAA;AACnB,EAAA;AAEA,EAAA,MAAMK,SAAS,MAAMC,wBAAAA,CAAOP,OAAAA,EAASG,cAAAA,CAAeK,MAAMN,SAAAA,CAAAA;AAE1D,EAAA,MAAMO,WAAY,MAAMT,OAAAA,CAAQU,QAAAA,CAASC,UAAAA,CAAWL,OAAOM,IAAAA,EAAM;AAC/DC,IAAAA,QAAAA,EAAUP,MAAAA,CAAOQ,IAAAA;IACjBC,cAAAA,EAAgB;GAClB,CAAA;AAEA,EAAA,IAAIC,aAAab,cAAAA,CAAec,IAAAA;AAChC,EAAA,IAAI,CAACD,UAAAA,EAAY;AACfA,IAAAA,UAAAA,GAAa,SAAA;AACf,EAAA;AAEA,EAAA,OAAOP,SAASO,UAAAA,CAAAA,IAAeP,QAAAA,CAAS,CAAA,QAAA,EAAMO,UAAAA,CAAAA,CAAY,CAAA;AAC5D;AAzBsBjB,wBAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-PX45HDHT.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { bundle } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult = any>(\n context: Context,\n type: TypeDefinitionParameter,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n const resolved = (await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n })) as Record<string, any>;\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n return resolved[exportName] ?? resolved[`__Ω${exportName}`];\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkMWW5SYZW_cjs = require('./chunk-MWW5SYZW.cjs');
3
+ var chunkXJJATLHR_cjs = require('./chunk-XJJATLHR.cjs');
4
4
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
5
5
  var types = require('@storm-software/config-tools/types');
6
6
  var esbuild = require('esbuild');
@@ -11,7 +11,7 @@ async function bundle(context, file, overrides = {}) {
11
11
  throw new Error(`Module not found: "${file}". Please check the path and try again.`);
12
12
  }
13
13
  const result = await esbuild.build({
14
- ...chunkMWW5SYZW_cjs.extractESBuildConfig(context),
14
+ ...chunkXJJATLHR_cjs.extractESBuildConfig(context),
15
15
  entryPoints: [
16
16
  path
17
17
  ],
@@ -39,5 +39,5 @@ async function bundle(context, file, overrides = {}) {
39
39
  chunkPK6SKIKE_cjs.__name(bundle, "bundle");
40
40
 
41
41
  exports.bundle = bundle;
42
- //# sourceMappingURL=chunk-GKUDVJPX.cjs.map
43
- //# sourceMappingURL=chunk-GKUDVJPX.cjs.map
42
+ //# sourceMappingURL=chunk-RK5MATYS.cjs.map
43
+ //# sourceMappingURL=chunk-RK5MATYS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/utilities/bundle.ts"],"names":["bundle","context","file","overrides","path","fs","resolve","existsSync","Error","result","build","extractESBuildConfig","entryPoints","write","sourcemap","splitting","treeShaking","packages","platform","logLevel","errors","length","map","error","text","join","warnings","log","LogLevelLabel","WARN","warning","outputFiles","filter","Boolean"],"mappings":";;;;;;;AAgCA,eAAsBA,MAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,MAAMC,IAAAA,GAAO,MAAMH,OAAAA,CAAQI,EAAAA,CAAGC,QAAQJ,IAAAA,CAAAA;AACtC,EAAA,IAAI,CAACE,IAAAA,IAAQ,CAACH,QAAQI,EAAAA,CAAGE,UAAAA,CAAWH,IAAAA,CAAAA,EAAO;AACzC,IAAA,MAAM,IAAII,KAAAA,CACR,CAAA,mBAAA,EAAsBN,IAAAA,CAAAA,uCAAAA,CAA6C,CAAA;AAEvE,EAAA;AAEA,EAAA,MAAMO,MAAA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,WAAAA,CAAYC,MAAAA,CAAOC,OAAAA,EAAS,CAAA,CAAA;AAC5C;AAjDsBjC,wBAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"chunk-GKUDVJPX.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { build, BuildOptions, OutputFile } from \"esbuild\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { extractESBuildConfig } from \"../build/esbuild\";\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle(\n context: Context,\n file: string,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const result = await build({\n ...extractESBuildConfig(context),\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: false,\n bundle: true,\n packages: \"external\",\n platform: \"node\",\n logLevel: \"silent\",\n ...overrides\n } as BuildOptions);\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to transpile ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.log(\n LogLevelLabel.WARN,\n `Warnings while transpiling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/utilities/bundle.ts"],"names":["bundle","context","file","overrides","path","fs","resolve","existsSync","Error","result","build","extractESBuildConfig","entryPoints","write","sourcemap","splitting","treeShaking","packages","platform","logLevel","errors","length","map","error","text","join","warnings","log","LogLevelLabel","WARN","warning","outputFiles","filter","Boolean"],"mappings":";;;;;;;AAgCA,eAAsBA,MAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,MAAMC,IAAAA,GAAO,MAAMH,OAAAA,CAAQI,EAAAA,CAAGC,QAAQJ,IAAAA,CAAAA;AACtC,EAAA,IAAI,CAACE,IAAAA,IAAQ,CAACH,QAAQI,EAAAA,CAAGE,UAAAA,CAAWH,IAAAA,CAAAA,EAAO;AACzC,IAAA,MAAM,IAAII,KAAAA,CACR,CAAA,mBAAA,EAAsBN,IAAAA,CAAAA,uCAAAA,CAA6C,CAAA;AAEvE,EAAA;AAEA,EAAA,MAAMO,MAAAA,GAAS,MAAMC,aAAAA,CAAM;AACzB,IAAA,GAAGC,uCAAqBV,OAAAA,CAAAA;IACxBW,WAAAA,EAAa;AAACR,MAAAA;;IACdS,KAAAA,EAAO,KAAA;IACPC,SAAAA,EAAW,KAAA;IACXC,SAAAA,EAAW,KAAA;IACXC,WAAAA,EAAa,KAAA;IACbhB,MAAAA,EAAQ,IAAA;IACRiB,QAAAA,EAAU,UAAA;IACVC,QAAAA,EAAU,MAAA;IACVC,QAAAA,EAAU,QAAA;IACV,GAAGhB;GACL,CAAA;AACA,EAAA,IAAIM,MAAAA,CAAOW,MAAAA,CAAOC,MAAAA,GAAS,CAAA,EAAG;AAC5B,IAAA,MAAM,IAAIb,KAAAA,CACR,CAAA,oBAAA,EAAuBN,IAAAA,CAAAA,EAAAA,EAASO,OAAOW,MAAAA,CACpCE,GAAAA,CAAIC,CAAAA,KAAAA,KAASA,MAAMC,IAAI,CAAA,CACvBC,IAAAA,CAAK,IAAA,CAAA,CAAA,CAAO,CAAA;AAEnB,EAAA;AACA,EAAA,IAAIhB,MAAAA,CAAOiB,QAAAA,CAASL,MAAAA,GAAS,CAAA,EAAG;AAC9BpB,IAAAA,OAAAA,CAAQ0B,IACNC,mBAAAA,CAAcC,IAAAA,EACd,CAAA,2BAAA,EAA8B3B,IAAAA,KAASO,MAAAA,CAAOiB,QAAAA,CAC3CJ,GAAAA,CAAIQ,CAAAA,YAAWA,OAAAA,CAAQN,IAAI,EAC3BC,IAAAA,CAAK,IAAA,CAAA,CAAA,CAAO,CAAA;AAEnB,EAAA;AACA,EAAA,IAAI,CAAChB,OAAOsB,WAAAA,IAAetB,MAAAA,CAAOsB,YAAYC,MAAAA,CAAOC,OAAAA,CAAAA,CAASZ,MAAAA,KAAW,CAAA,EAAG;AAC1E,IAAA,MAAM,IAAIb,KAAAA,CACR,CAAA,8BAAA,EACEN,IAAAA,CAAAA,+CAAAA,CAC+C,CAAA;AAErD,EAAA;AAEA,EAAA,OAAOO,MAAAA,CAAOsB,WAAAA,CAAYC,MAAAA,CAAOC,OAAAA,EAAS,CAAA,CAAA;AAC5C;AAjDsBjC,wBAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"chunk-RK5MATYS.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { build, BuildOptions, OutputFile } from \"esbuild\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { extractESBuildConfig } from \"../build/esbuild\";\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle(\n context: Context,\n file: string,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const result = await build({\n ...extractESBuildConfig(context),\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: false,\n bundle: true,\n packages: \"external\",\n platform: \"node\",\n logLevel: \"silent\",\n ...overrides\n } as BuildOptions);\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to transpile ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.log(\n LogLevelLabel.WARN,\n `Warnings while transpiling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { resolveESBuildEntry } from './chunk-2OW63XO3.js';
1
+ import { resolveESBuildEntry } from './chunk-SZ6UL7UR.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { DEFAULT_BUILD_OPTIONS } from '@storm-software/tsup/constants';
4
4
  import { toArray } from '@stryke/convert/to-array';
@@ -80,5 +80,5 @@ function extractTsupConfig(context) {
80
80
  __name(extractTsupConfig, "extractTsupConfig");
81
81
 
82
82
  export { DEFAULT_TSUP_CONFIG, extractTsupConfig, resolveTsupEntry };
83
- //# sourceMappingURL=chunk-VL5H4HKR.js.map
84
- //# sourceMappingURL=chunk-VL5H4HKR.js.map
83
+ //# sourceMappingURL=chunk-S3GKFOT6.js.map
84
+ //# sourceMappingURL=chunk-S3GKFOT6.js.map