@powerlines/plugin-vite 0.14.299 → 0.14.301

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 (155) hide show
  1. package/dist/build-CKSRktJj.d.mts +13 -0
  2. package/dist/build-CKSRktJj.d.mts.map +1 -0
  3. package/dist/build-DJTI0ZMx.cjs +0 -0
  4. package/dist/build-DVley5x8.d.cts +13 -0
  5. package/dist/build-DVley5x8.d.cts.map +1 -0
  6. package/dist/build-D_6wweLB.mjs +1 -0
  7. package/dist/helpers/index.cjs +6 -5
  8. package/dist/helpers/index.d.cts +5 -2
  9. package/dist/helpers/index.d.mts +5 -2
  10. package/dist/helpers/index.mjs +3 -2
  11. package/dist/helpers/resolve-options.cjs +3 -70
  12. package/dist/helpers/resolve-options.d.cts +3 -15
  13. package/dist/helpers/resolve-options.d.mts +3 -16
  14. package/dist/helpers/resolve-options.mjs +2 -68
  15. package/dist/helpers/unplugin.cjs +2 -11
  16. package/dist/helpers/unplugin.d.cts +4 -8
  17. package/dist/helpers/unplugin.d.mts +4 -8
  18. package/dist/helpers/unplugin.mjs +2 -11
  19. package/dist/helpers-DvTULET6.mjs +1 -0
  20. package/dist/helpers-yB1XkvQI.cjs +0 -0
  21. package/dist/index-B8OHl-c_.d.mts +1 -0
  22. package/dist/index-C-svZlpj.d.mts +1 -0
  23. package/dist/index-CFG0_wK4.d.cts +1 -0
  24. package/dist/index-CtCMUyZA.d.cts +1 -0
  25. package/dist/index.cjs +13 -11
  26. package/dist/index.d.cts +7 -5
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +7 -8
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +6 -3
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/plugin-CfromG2s.d.cts +22 -0
  33. package/dist/plugin-CfromG2s.d.cts.map +1 -0
  34. package/dist/plugin-D5qyQPqC.cjs +0 -0
  35. package/dist/plugin-DIEwkIcq.d.mts +22 -0
  36. package/dist/plugin-DIEwkIcq.d.mts.map +1 -0
  37. package/dist/plugin-HyYPEfea.mjs +1 -0
  38. package/dist/resolve-options-CGWH6O9W.cjs +113 -0
  39. package/dist/resolve-options-CZfGIJwj.mjs +69 -0
  40. package/dist/resolve-options-CZfGIJwj.mjs.map +1 -0
  41. package/dist/resolve-options-Cjw3kuSJ.d.cts +15 -0
  42. package/dist/resolve-options-Cjw3kuSJ.d.cts.map +1 -0
  43. package/dist/resolve-options-DDD8d7th.d.mts +15 -0
  44. package/dist/resolve-options-DDD8d7th.d.mts.map +1 -0
  45. package/dist/types/_internal.d.cts +3 -2
  46. package/dist/types/_internal.d.cts.map +1 -1
  47. package/dist/types/_internal.d.mts +3 -2
  48. package/dist/types/_internal.d.mts.map +1 -1
  49. package/dist/types/build.cjs +1 -0
  50. package/dist/types/build.d.cts +2 -13
  51. package/dist/types/build.d.mts +2 -13
  52. package/dist/types/build.mjs +2 -0
  53. package/dist/types/index.cjs +3 -0
  54. package/dist/types/index.d.cts +3 -2
  55. package/dist/types/index.d.mts +3 -2
  56. package/dist/types/index.mjs +4 -0
  57. package/dist/types/plugin.cjs +1 -0
  58. package/dist/types/plugin.d.cts +3 -23
  59. package/dist/types/plugin.d.mts +3 -24
  60. package/dist/types/plugin.mjs +2 -0
  61. package/dist/types-Cn_AzV39.mjs +1 -0
  62. package/dist/types-D208vOSb.cjs +0 -0
  63. package/dist/unplugin-BIIMkEyS.cjs +16 -0
  64. package/dist/unplugin-CmW69N5s.mjs +11 -0
  65. package/dist/unplugin-CmW69N5s.mjs.map +1 -0
  66. package/dist/unplugin-DIdD8ka4.d.mts +8 -0
  67. package/dist/unplugin-DIdD8ka4.d.mts.map +1 -0
  68. package/dist/unplugin-hWdrpmFt.d.cts +8 -0
  69. package/dist/unplugin-hWdrpmFt.d.cts.map +1 -0
  70. package/package.json +6 -6
  71. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  72. package/dist/core/src/lib/entry.cjs +0 -13
  73. package/dist/core/src/lib/entry.mjs +0 -15
  74. package/dist/core/src/lib/logger.cjs +0 -41
  75. package/dist/core/src/lib/logger.mjs +0 -40
  76. package/dist/core/src/lib/logger.mjs.map +0 -1
  77. package/dist/core/src/lib/unplugin/helpers.cjs +0 -19
  78. package/dist/core/src/lib/unplugin/helpers.mjs +0 -19
  79. package/dist/core/src/lib/unplugin/helpers.mjs.map +0 -1
  80. package/dist/core/src/lib/unplugin/index.cjs +0 -3
  81. package/dist/core/src/lib/unplugin/index.mjs +0 -5
  82. package/dist/core/src/lib/unplugin/module-resolution.cjs +0 -66
  83. package/dist/core/src/lib/unplugin/module-resolution.mjs +0 -66
  84. package/dist/core/src/lib/unplugin/module-resolution.mjs.map +0 -1
  85. package/dist/core/src/lib/unplugin/plugin.cjs +0 -71
  86. package/dist/core/src/lib/unplugin/plugin.mjs +0 -71
  87. package/dist/core/src/lib/unplugin/plugin.mjs.map +0 -1
  88. package/dist/core/src/lib/utilities/source-file.cjs +0 -22
  89. package/dist/core/src/lib/utilities/source-file.mjs +0 -21
  90. package/dist/core/src/lib/utilities/source-file.mjs.map +0 -1
  91. package/dist/core/src/plugin-utils/paths.cjs +0 -2
  92. package/dist/core/src/plugin-utils/paths.mjs +0 -4
  93. package/dist/core/src/types/_internal.d.cts +0 -85
  94. package/dist/core/src/types/_internal.d.cts.map +0 -1
  95. package/dist/core/src/types/_internal.d.mts +0 -85
  96. package/dist/core/src/types/_internal.d.mts.map +0 -1
  97. package/dist/core/src/types/api.d.cts +0 -103
  98. package/dist/core/src/types/api.d.cts.map +0 -1
  99. package/dist/core/src/types/api.d.mts +0 -103
  100. package/dist/core/src/types/api.d.mts.map +0 -1
  101. package/dist/core/src/types/commands.d.cts +0 -9
  102. package/dist/core/src/types/commands.d.cts.map +0 -1
  103. package/dist/core/src/types/commands.d.mts +0 -10
  104. package/dist/core/src/types/commands.d.mts.map +0 -1
  105. package/dist/core/src/types/config.d.cts +0 -552
  106. package/dist/core/src/types/config.d.cts.map +0 -1
  107. package/dist/core/src/types/config.d.mts +0 -552
  108. package/dist/core/src/types/config.d.mts.map +0 -1
  109. package/dist/core/src/types/context.d.cts +0 -511
  110. package/dist/core/src/types/context.d.cts.map +0 -1
  111. package/dist/core/src/types/context.d.mts +0 -511
  112. package/dist/core/src/types/context.d.mts.map +0 -1
  113. package/dist/core/src/types/fs.d.cts +0 -487
  114. package/dist/core/src/types/fs.d.cts.map +0 -1
  115. package/dist/core/src/types/fs.d.mts +0 -487
  116. package/dist/core/src/types/fs.d.mts.map +0 -1
  117. package/dist/core/src/types/hooks.d.cts +0 -99
  118. package/dist/core/src/types/hooks.d.cts.map +0 -1
  119. package/dist/core/src/types/hooks.d.mts +0 -99
  120. package/dist/core/src/types/hooks.d.mts.map +0 -1
  121. package/dist/core/src/types/index.d.mts +0 -9
  122. package/dist/core/src/types/plugin.d.cts +0 -204
  123. package/dist/core/src/types/plugin.d.cts.map +0 -1
  124. package/dist/core/src/types/plugin.d.mts +0 -204
  125. package/dist/core/src/types/plugin.d.mts.map +0 -1
  126. package/dist/core/src/types/tsconfig.d.cts +0 -70
  127. package/dist/core/src/types/tsconfig.d.cts.map +0 -1
  128. package/dist/core/src/types/tsconfig.d.mts +0 -70
  129. package/dist/core/src/types/tsconfig.d.mts.map +0 -1
  130. package/dist/core/src/types/unplugin.cjs +0 -21
  131. package/dist/core/src/types/unplugin.d.cts +0 -24
  132. package/dist/core/src/types/unplugin.d.cts.map +0 -1
  133. package/dist/core/src/types/unplugin.d.mts +0 -25
  134. package/dist/core/src/types/unplugin.d.mts.map +0 -1
  135. package/dist/core/src/types/unplugin.mjs +0 -22
  136. package/dist/core/src/types/unplugin.mjs.map +0 -1
  137. package/dist/helpers/resolve-options.d.cts.map +0 -1
  138. package/dist/helpers/resolve-options.d.mts.map +0 -1
  139. package/dist/helpers/resolve-options.mjs.map +0 -1
  140. package/dist/helpers/unplugin.d.cts.map +0 -1
  141. package/dist/helpers/unplugin.d.mts.map +0 -1
  142. package/dist/helpers/unplugin.mjs.map +0 -1
  143. package/dist/plugin-esbuild/src/helpers/resolve-options.cjs +0 -74
  144. package/dist/plugin-esbuild/src/helpers/resolve-options.mjs +0 -73
  145. package/dist/plugin-esbuild/src/helpers/resolve-options.mjs.map +0 -1
  146. package/dist/plugin-rolldown/src/helpers/resolve-options.cjs +0 -122
  147. package/dist/plugin-rolldown/src/helpers/resolve-options.mjs +0 -117
  148. package/dist/plugin-rolldown/src/helpers/resolve-options.mjs.map +0 -1
  149. package/dist/plugin-rollup/src/helpers/resolve-options.cjs +0 -123
  150. package/dist/plugin-rollup/src/helpers/resolve-options.mjs +0 -116
  151. package/dist/plugin-rollup/src/helpers/resolve-options.mjs.map +0 -1
  152. package/dist/types/build.d.cts.map +0 -1
  153. package/dist/types/build.d.mts.map +0 -1
  154. package/dist/types/plugin.d.cts.map +0 -1
  155. package/dist/types/plugin.d.mts.map +0 -1
@@ -1,40 +0,0 @@
1
- import { LogLevelLabel } from "@storm-software/config-tools/types";
2
- import { kebabCase } from "@stryke/string-format/kebab-case";
3
- import { titleCase } from "@stryke/string-format/title-case";
4
- import "@storm-software/config-tools/logger";
5
- import "@storm-software/config-tools/utilities/colors";
6
- import "@stryke/helpers/noop";
7
- import chalk from "chalk";
8
-
9
- //#region ../core/src/lib/logger.ts
10
- const BADGE_COLORS = [
11
- "#00A0DD",
12
- "#6FCE4E",
13
- "#FBBF24",
14
- "#F43F5E",
15
- "#3B82F6",
16
- "#A855F7",
17
- "#469592",
18
- "#288EDF",
19
- "#D8B4FE",
20
- "#10B981",
21
- "#EF4444",
22
- "#F0EC56",
23
- "#F472B6",
24
- "#22D3EE",
25
- "#EAB308",
26
- "#84CC16",
27
- "#F87171",
28
- "#0EA5E9",
29
- "#D946EF",
30
- "#FACC15",
31
- "#34D399",
32
- "#8B5CF6"
33
- ];
34
- const extendLog = (logFn, name) => {
35
- return (type, ...args) => logFn(type, ` ${chalk.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
36
- };
37
-
38
- //#endregion
39
- export { extendLog };
40
- //# sourceMappingURL=logger.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.mjs","names":[],"sources":["../../../../../core/src/lib/logger.ts"],"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 { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { noop } from \"@stryke/helpers/noop\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport chalk from \"chalk\";\nimport type { LogFn, WorkspaceConfig } from \"../types\";\n\nexport interface CreateLogOptions {\n name?: string;\n logLevel?: LogLevelLabel | null;\n customLogger?: LogFn;\n colors?: WorkspaceConfig[\"colors\"];\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function.\n * @returns A logging function.\n */\nexport const createLog = (\n name: string | null,\n options: CreateLogOptions = {}\n): LogFn => {\n const logLevel =\n options.logLevel === null\n ? LogLevelLabel.SILENT\n : options.logLevel || LogLevelLabel.INFO;\n if (logLevel === LogLevelLabel.SILENT) {\n return noop;\n }\n\n if (options.customLogger) {\n return options.customLogger;\n }\n\n return (type: LogLevelLabel, ...args: string[]) =>\n getLogFn(getLogLevel(type), {\n ...options,\n logLevel\n })(\n `${chalk.bold.hex(\n getColor(\"brand\", options as Parameters<typeof getColor>[1])\n )(\n `${name ? kebabCase(name) : \"\"}${options.name ? `${name ? chalk.gray(\" > \") : \"\"}${kebabCase(options.name)}` : \"\"}${chalk.gray(\" > \")}`\n )}${args.join(\" \")} `.trim()\n );\n};\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\nexport const extendLog = (logFn: LogFn, name: string): LogFn => {\n return (type: LogLevelLabel, ...args: string[]) =>\n logFn(\n type,\n ` ${chalk.inverse.hex(\n BADGE_COLORS[\n name\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n )(` ${titleCase(name)} `)} ${args.join(\" \")} `\n );\n};\n"],"mappings":";;;;;;;;;AAsEA,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,aAAa,OAAc,SAAwB;AAC9D,SAAQ,MAAqB,GAAG,SAC9B,MACE,MACA,IAAI,MAAM,QAAQ,IAChB,aACE,KACG,MAAM,GAAG,CACT,KAAI,SAAQ,KAAK,WAAW,EAAE,CAAC,CAC/B,QAAQ,KAAK,aAAa,MAAM,UAAU,EAAE,GAAG,aAAa,WAC5D,aAAa,GACnB,CAAC,IAAI,UAAU,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,GAC9C"}
@@ -1,19 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- require('../../types/unplugin.cjs');
3
- let defu = require("defu");
4
- require("@stryke/type-checks/is-set-string");
5
-
6
- //#region ../core/src/lib/unplugin/helpers.ts
7
- /**
8
- * Merges a base plugin context with an unplugin context, combining their properties.
9
- *
10
- * @param contextA - The base plugin context to merge into.
11
- * @param contextB - The unplugin context to merge from.
12
- * @returns The merged context.
13
- */
14
- function combineContexts(contextA, contextB) {
15
- return (0, defu.defu)(contextA, contextB);
16
- }
17
-
18
- //#endregion
19
- exports.combineContexts = combineContexts;
@@ -1,19 +0,0 @@
1
- import "../../types/unplugin.mjs";
2
- import { defu as defu$1 } from "defu";
3
- import "@stryke/type-checks/is-set-string";
4
-
5
- //#region ../core/src/lib/unplugin/helpers.ts
6
- /**
7
- * Merges a base plugin context with an unplugin context, combining their properties.
8
- *
9
- * @param contextA - The base plugin context to merge into.
10
- * @param contextB - The unplugin context to merge from.
11
- * @returns The merged context.
12
- */
13
- function combineContexts(contextA, contextB) {
14
- return defu$1(contextA, contextB);
15
- }
16
-
17
- //#endregion
18
- export { combineContexts };
19
- //# sourceMappingURL=helpers.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.mjs","names":["defu"],"sources":["../../../../../../core/src/lib/unplugin/helpers.ts"],"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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport { UnpluginBuildContext } from \"unplugin\";\nimport { UnresolvedContext } from \"../../types/context\";\nimport {\n UNPLUGIN_BUILDER_VARIANTS,\n UnpluginBuilderVariant\n} from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgB,gBAGd,UAAqB,UAA4C;AACjE,QAAOA,OAAK,UAAU,SAAS"}
@@ -1,3 +0,0 @@
1
- const require_helpers = require('./helpers.cjs');
2
- const require_module_resolution = require('./module-resolution.cjs');
3
- const require_plugin = require('./plugin.cjs');
@@ -1,5 +0,0 @@
1
- import { combineContexts } from "./helpers.mjs";
2
- import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
3
- import { createUnplugin } from "./plugin.mjs";
4
-
5
- export { };
@@ -1,66 +0,0 @@
1
-
2
- //#region ../core/src/lib/unplugin/module-resolution.ts
3
- /**
4
- * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
5
- *
6
- * @remarks
7
- * This includes the `resolveId` and `load` hooks.
8
- *
9
- * @see https://rollupjs.org/plugin-development/#resolveid
10
- * @see https://rollupjs.org/plugin-development/#load
11
- *
12
- * @param context - The plugin context.
13
- * @returns The module resolution hooks (`resolveId` and `load`).
14
- */
15
- function createUnpluginModuleResolutionFunctions(context) {
16
- const ctx = context;
17
- async function resolveId(id, importer, opts = { isEntry: false }) {
18
- let result = await ctx.$$internal.callHook("resolveId", {
19
- sequential: true,
20
- result: "first",
21
- order: "pre"
22
- }, id, importer, opts);
23
- if (result) return result;
24
- result = await ctx.$$internal.callHook("resolveId", {
25
- sequential: true,
26
- result: "first",
27
- order: "normal"
28
- }, id, importer, opts);
29
- if (result) return result;
30
- result = await ctx.resolve(id, importer, opts);
31
- if (result) return result;
32
- return ctx.$$internal.callHook("resolveId", {
33
- sequential: true,
34
- result: "first",
35
- order: "post"
36
- }, id, importer, opts);
37
- }
38
- async function load(id) {
39
- let result = await ctx.$$internal.callHook("load", {
40
- sequential: true,
41
- result: "first",
42
- order: "pre"
43
- }, id);
44
- if (result) return result;
45
- result = await ctx.$$internal.callHook("load", {
46
- sequential: true,
47
- result: "first",
48
- order: "normal"
49
- }, id);
50
- if (result) return result;
51
- result = await ctx.load(id);
52
- if (result) return result;
53
- return ctx.$$internal.callHook("load", {
54
- sequential: true,
55
- result: "first",
56
- order: "post"
57
- }, id);
58
- }
59
- return {
60
- resolveId,
61
- load
62
- };
63
- }
64
-
65
- //#endregion
66
- exports.createUnpluginModuleResolutionFunctions = createUnpluginModuleResolutionFunctions;
@@ -1,66 +0,0 @@
1
- //#region ../core/src/lib/unplugin/module-resolution.ts
2
- /**
3
- * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
4
- *
5
- * @remarks
6
- * This includes the `resolveId` and `load` hooks.
7
- *
8
- * @see https://rollupjs.org/plugin-development/#resolveid
9
- * @see https://rollupjs.org/plugin-development/#load
10
- *
11
- * @param context - The plugin context.
12
- * @returns The module resolution hooks (`resolveId` and `load`).
13
- */
14
- function createUnpluginModuleResolutionFunctions(context) {
15
- const ctx = context;
16
- async function resolveId(id, importer, opts = { isEntry: false }) {
17
- let result = await ctx.$$internal.callHook("resolveId", {
18
- sequential: true,
19
- result: "first",
20
- order: "pre"
21
- }, id, importer, opts);
22
- if (result) return result;
23
- result = await ctx.$$internal.callHook("resolveId", {
24
- sequential: true,
25
- result: "first",
26
- order: "normal"
27
- }, id, importer, opts);
28
- if (result) return result;
29
- result = await ctx.resolve(id, importer, opts);
30
- if (result) return result;
31
- return ctx.$$internal.callHook("resolveId", {
32
- sequential: true,
33
- result: "first",
34
- order: "post"
35
- }, id, importer, opts);
36
- }
37
- async function load(id) {
38
- let result = await ctx.$$internal.callHook("load", {
39
- sequential: true,
40
- result: "first",
41
- order: "pre"
42
- }, id);
43
- if (result) return result;
44
- result = await ctx.$$internal.callHook("load", {
45
- sequential: true,
46
- result: "first",
47
- order: "normal"
48
- }, id);
49
- if (result) return result;
50
- result = await ctx.load(id);
51
- if (result) return result;
52
- return ctx.$$internal.callHook("load", {
53
- sequential: true,
54
- result: "first",
55
- order: "post"
56
- }, id);
57
- }
58
- return {
59
- resolveId,
60
- load
61
- };
62
- }
63
-
64
- //#endregion
65
- export { createUnpluginModuleResolutionFunctions };
66
- //# sourceMappingURL=module-resolution.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../../../../core/src/lib/unplugin/module-resolution.ts"],"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 { LoadResult } from \"rollup\";\nimport type {\n ExternalIdResult,\n HookFnMap,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends PluginContext = PluginContext\n>(context: TContext): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id\n );\n }\n\n return {\n resolveId,\n load\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAgB,wCAEd,SAA0D;CAC1D,MAAM,MAAM;CAEZ,eAAe,UAEb,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;EACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,QAAQ,IAAI,UAAU,KAAK;AAC9C,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;;CAGH,eAAe,KAEb,IACwC;EACxC,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,KAAK,GAAG;AAC3B,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;;AAGH,QAAO;EACL;EACA;EACD"}
@@ -1,71 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_helpers = require('./helpers.cjs');
3
- const require_module_resolution = require('./module-resolution.cjs');
4
- const require_logger = require('../logger.cjs');
5
- const require_source_file = require('../utilities/source-file.cjs');
6
- let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
7
- let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
8
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
9
- let unplugin = require("unplugin");
10
-
11
- //#region ../core/src/lib/unplugin/plugin.ts
12
- /**
13
- * Creates a Powerlines unplugin instance.
14
- *
15
- * @param context - The plugin context.
16
- * @returns The unplugin instance.
17
- */
18
- function createUnplugin(context, name = "unplugin") {
19
- const ctx = context;
20
- (0, unplugin.setParseImpl)(ctx.parse);
21
- return () => {
22
- const log = require_logger.extendLog(ctx.log, name);
23
- log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
24
- try {
25
- const { resolveId, load } = require_module_resolution.createUnpluginModuleResolutionFunctions(context);
26
- async function buildStart() {
27
- log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
28
- await ctx.$$internal.callHook("buildStart", { sequential: true });
29
- }
30
- async function transform(code, id) {
31
- let transformed = code;
32
- for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
33
- const result = await hook.handler.apply(require_helpers.combineContexts(ctx, this), [require_source_file.getString(transformed), id]);
34
- if (result) transformed = result;
35
- }
36
- return transformed;
37
- }
38
- async function buildEnd() {
39
- log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
40
- return ctx.$$internal.callHook("buildEnd", { sequential: true });
41
- }
42
- async function writeBundle() {
43
- log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
44
- return ctx.$$internal.callHook("writeBundle", { sequential: true });
45
- }
46
- return {
47
- name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${(0, __stryke_string_format_kebab_case.kebabCase)(name)}`,
48
- api: ctx.$$internal.api,
49
- resolveId: {
50
- filter: { id: { include: [/.*/] } },
51
- handler: resolveId
52
- },
53
- load: {
54
- filter: { id: { include: [/.*/] } },
55
- handler: load
56
- },
57
- transform,
58
- buildStart,
59
- buildEnd,
60
- writeBundle,
61
- vite: { sharedDuringBuild: true }
62
- };
63
- } catch (error) {
64
- log(__storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
65
- throw error;
66
- }
67
- };
68
- }
69
-
70
- //#endregion
71
- exports.createUnplugin = createUnplugin;
@@ -1,71 +0,0 @@
1
- import { combineContexts } from "./helpers.mjs";
2
- import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
3
- import { extendLog } from "../logger.mjs";
4
- import { getString } from "../utilities/source-file.mjs";
5
- import { LogLevelLabel } from "@storm-software/config-tools/types";
6
- import { kebabCase } from "@stryke/string-format/kebab-case";
7
- import { titleCase } from "@stryke/string-format/title-case";
8
- import { setParseImpl } from "unplugin";
9
-
10
- //#region ../core/src/lib/unplugin/plugin.ts
11
- /**
12
- * Creates a Powerlines unplugin instance.
13
- *
14
- * @param context - The plugin context.
15
- * @returns The unplugin instance.
16
- */
17
- function createUnplugin(context, name = "unplugin") {
18
- const ctx = context;
19
- setParseImpl(ctx.parse);
20
- return () => {
21
- const log = extendLog(ctx.log, name);
22
- log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
23
- try {
24
- const { resolveId, load } = createUnpluginModuleResolutionFunctions(context);
25
- async function buildStart() {
26
- log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
27
- await ctx.$$internal.callHook("buildStart", { sequential: true });
28
- }
29
- async function transform(code, id) {
30
- let transformed = code;
31
- for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
32
- const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), id]);
33
- if (result) transformed = result;
34
- }
35
- return transformed;
36
- }
37
- async function buildEnd() {
38
- log(LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
39
- return ctx.$$internal.callHook("buildEnd", { sequential: true });
40
- }
41
- async function writeBundle() {
42
- log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
43
- return ctx.$$internal.callHook("writeBundle", { sequential: true });
44
- }
45
- return {
46
- name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
47
- api: ctx.$$internal.api,
48
- resolveId: {
49
- filter: { id: { include: [/.*/] } },
50
- handler: resolveId
51
- },
52
- load: {
53
- filter: { id: { include: [/.*/] } },
54
- handler: load
55
- },
56
- transform,
57
- buildStart,
58
- buildEnd,
59
- writeBundle,
60
- vite: { sharedDuringBuild: true }
61
- };
62
- } catch (error) {
63
- log(LogLevelLabel.FATAL, error?.message);
64
- throw error;
65
- }
66
- };
67
- }
68
-
69
- //#endregion
70
- export { createUnplugin };
71
- //# sourceMappingURL=plugin.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.mjs","names":["transformed: TransformResult | string","result: TransformResult | string | undefined"],"sources":["../../../../../../core/src/lib/unplugin/plugin.ts"],"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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport { createUnpluginModuleResolutionFunctions } from \"./module-resolution\";\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(context: TContext, name = \"unplugin\"): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n name = \"unplugin\"\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmGA,SAAgB,eACd,SACA,OAAO,YACoB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,QAAQ;GAE5D,eAAe,aAAuC;AACpD,QAAI,cAAc,OAAO,sCAAsC;AAE/D,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAIA,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAMC,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GACD,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,cAAc,OAAO,uCAAuC;AAEhE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,cAAc,OAAO,0CAA0C;AAEnE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
@@ -1,22 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
3
- require("@stryke/fs/read-file");
4
- let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
5
- require("magic-string");
6
-
7
- //#region ../core/src/lib/utilities/source-file.ts
8
- /**
9
- * Get the string from the source.
10
- *
11
- * @param code - The source string or magic string.
12
- * @returns The source string.
13
- */
14
- function getString(code) {
15
- if (!code) return "";
16
- if ((0, __stryke_type_checks_is_string.isString)(code)) return code;
17
- if ((0, __stryke_type_checks_is_set_object.isSetObject)(code) && "code" in code) return code.code;
18
- return code.toString();
19
- }
20
-
21
- //#endregion
22
- exports.getString = getString;
@@ -1,21 +0,0 @@
1
- import { isString } from "@stryke/type-checks/is-string";
2
- import "@stryke/fs/read-file";
3
- import { isSetObject } from "@stryke/type-checks/is-set-object";
4
-
5
- //#region ../core/src/lib/utilities/source-file.ts
6
- /**
7
- * Get the string from the source.
8
- *
9
- * @param code - The source string or magic string.
10
- * @returns The source string.
11
- */
12
- function getString(code) {
13
- if (!code) return "";
14
- if (isString(code)) return code;
15
- if (isSetObject(code) && "code" in code) return code.code;
16
- return code.toString();
17
- }
18
-
19
- //#endregion
20
- export { getString };
21
- //# sourceMappingURL=source-file.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-file.mjs","names":[],"sources":["../../../../../../core/src/lib/utilities/source-file.ts"],"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 { readFileIfExistingSync } from \"@stryke/fs/read-file\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport MagicString from \"magic-string\";\nimport { TransformResult } from \"unplugin\";\nimport { SourceFile } from \"../../types/context\";\n\n/**\n * Get the string from the source.\n *\n * @param code - The source string or magic string.\n * @returns The source string.\n */\nexport function getString(\n code: string | MagicString | TransformResult\n): string {\n if (!code) {\n return \"\";\n }\n\n if (isString(code)) {\n return code;\n }\n\n if (isSetObject(code) && \"code\" in code) {\n return code.code;\n }\n\n return code.toString();\n}\n\n/**\n * Get the magic string.\n *\n * @param code - The source string or magic string.\n * @returns The magic string.\n */\nexport function getMagicString(code: string | MagicString): MagicString {\n if (isString(code)) {\n return new MagicString(code);\n }\n\n return code;\n}\n\n/**\n * Get the source file.\n *\n * @param code - The source code.\n * @param id - The name of the file.\n * @returns The source file.\n */\nexport function getSourceFile(\n code: string | MagicString,\n id: string\n): SourceFile {\n const content = code ?? readFileIfExistingSync(id);\n\n return {\n id,\n code: getMagicString(content),\n env: []\n };\n}\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,UACd,MACQ;AACR,KAAI,CAAC,KACH,QAAO;AAGT,KAAI,SAAS,KAAK,CAChB,QAAO;AAGT,KAAI,YAAY,KAAK,IAAI,UAAU,KACjC,QAAO,KAAK;AAGd,QAAO,KAAK,UAAU"}
@@ -1,2 +0,0 @@
1
- require("@stryke/path/replace");
2
- require("@stryke/path/join");
@@ -1,4 +0,0 @@
1
- import "@stryke/path/replace";
2
- import "@stryke/path/join";
3
-
4
- export { };
@@ -1,85 +0,0 @@
1
- import { CallHookOptions, InferHookParameters, InferHookReturnType } from "./hooks.cjs";
2
- import { EnvironmentContext, PluginContext } from "./context.cjs";
3
- import { PluginConfig, ResolvedConfig } from "./config.cjs";
4
- import { API } from "./api.cjs";
5
-
6
- //#region ../core/src/types/_internal.d.ts
7
-
8
- /**
9
- * Internal fields and methods for internal contexts
10
- *
11
- * @internal
12
- */
13
- interface UNSAFE_ContextInternal<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
14
- /**
15
- * The API instance for interacting with Powerlines
16
- *
17
- * @internal
18
- */
19
- api: API<TResolvedConfig>;
20
- /**
21
- * Add a Powerlines plugin used in the build process
22
- *
23
- * @internal
24
- *
25
- * @param config - The import path of the plugin to add
26
- */
27
- addPlugin: (config: PluginConfig<PluginContext<TResolvedConfig>>) => Promise<void>;
28
- }
29
- /**
30
- * An internal representation of the environment context, used for managing hooks and environment data.
31
- *
32
- * @internal
33
- */
34
- interface UNSAFE_EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends EnvironmentContext<TResolvedConfig> {
35
- $$internal: UNSAFE_ContextInternal<TResolvedConfig>;
36
- }
37
- /**
38
- * Internal fields and methods for the internal plugin context
39
- *
40
- * @internal
41
- */
42
- interface UNSAFE_PluginContextInternal<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends UNSAFE_ContextInternal<TResolvedConfig> {
43
- /**
44
- * The API instance for interacting with Powerlines
45
- *
46
- * @internal
47
- */
48
- api: API<TResolvedConfig>;
49
- /**
50
- * The environment context associated with this plugin context
51
- *
52
- * @internal
53
- */
54
- environment: UNSAFE_EnvironmentContext<TResolvedConfig>;
55
- /**
56
- * Call a hook within the Powerlines system
57
- *
58
- * @internal
59
- *
60
- * @param hook - The name of the hook to call
61
- * @param options - Options for calling the hook
62
- * @param args - Arguments to pass to the hook
63
- * @returns The result of the hook call
64
- */
65
- callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
66
- environment?: string | EnvironmentContext<TResolvedConfig>;
67
- }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
68
- /**
69
- * A place to store internal data for the plugin context
70
- *
71
- * @internal
72
- */
73
- meta: Record<string, any>;
74
- }
75
- /**
76
- * An internal representation of the plugin context, used for managing hooks and environment data.
77
- *
78
- * @internal
79
- */
80
- interface UNSAFE_PluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PluginContext<TResolvedConfig> {
81
- $$internal: UNSAFE_PluginContextInternal<TResolvedConfig>;
82
- }
83
- //#endregion
84
- export { UNSAFE_PluginContext };
85
- //# sourceMappingURL=_internal.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_internal.d.cts","names":[],"sources":["../../../../../core/src/types/_internal.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAuCA;;;AAQW,UARM,sBAQN,CAAA,wBAPe,cAOf,GAPgC,cAOhC,CAAA,CAAA;EAAJ;;;;;EAWO,GAAA,EAXP,GAWO,CAXH,eAWG,CAAA;EA8BG;;;;;;;EAEW,SAAA,EAAA,CAAA,MAAA,EAjChB,YAiCgB,CAjCH,aAiCG,CAjCW,eAiCX,CAAA,CAAA,EAAA,GAhCrB,OAgCqB,CAAA,IAAA,CAAA;AAS5B;;;;;;AAEU,UAbO,yBAaP,CAAA,wBAZgB,cAYhB,GAZiC,cAYjC,CAAA,SAXA,kBAWA,CAXmB,eAWnB,CAAA,CAAA;EAAsB,UAAA,EAVlB,sBAUkB,CAVK,eAUL,CAAA;AAgDhC;;;;;;AAEU,UApDO,4BAoDP,CAAA,wBAnDgB,cAmDhB,GAnDiC,cAmDjC,CAAA,SAlDA,sBAkDA,CAlDuB,eAkDvB,CAAA,CAAA;EAAa;;;;;OA5ChB,IAAI;;;;;;eAOI,0BAA0B;;;;;;;;;;;wCAa/B,eACG;2BACgB,mBAAmB;cAEnC,oBAAoB,cAAc,kBAAkB,UAC1D,QACH,oBAAoB,cAAc,kBAAkB;;;;;;QAQhD;;;;;;;UAQS,6CACS,iBAAiB,wBACjC,cAAc;cACV,6BAA6B"}
@@ -1,85 +0,0 @@
1
- import { CallHookOptions, InferHookParameters, InferHookReturnType } from "./hooks.mjs";
2
- import { EnvironmentContext, PluginContext } from "./context.mjs";
3
- import { PluginConfig, ResolvedConfig } from "./config.mjs";
4
- import { API } from "./api.mjs";
5
-
6
- //#region ../core/src/types/_internal.d.ts
7
-
8
- /**
9
- * Internal fields and methods for internal contexts
10
- *
11
- * @internal
12
- */
13
- interface UNSAFE_ContextInternal<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
14
- /**
15
- * The API instance for interacting with Powerlines
16
- *
17
- * @internal
18
- */
19
- api: API<TResolvedConfig>;
20
- /**
21
- * Add a Powerlines plugin used in the build process
22
- *
23
- * @internal
24
- *
25
- * @param config - The import path of the plugin to add
26
- */
27
- addPlugin: (config: PluginConfig<PluginContext<TResolvedConfig>>) => Promise<void>;
28
- }
29
- /**
30
- * An internal representation of the environment context, used for managing hooks and environment data.
31
- *
32
- * @internal
33
- */
34
- interface UNSAFE_EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends EnvironmentContext<TResolvedConfig> {
35
- $$internal: UNSAFE_ContextInternal<TResolvedConfig>;
36
- }
37
- /**
38
- * Internal fields and methods for the internal plugin context
39
- *
40
- * @internal
41
- */
42
- interface UNSAFE_PluginContextInternal<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends UNSAFE_ContextInternal<TResolvedConfig> {
43
- /**
44
- * The API instance for interacting with Powerlines
45
- *
46
- * @internal
47
- */
48
- api: API<TResolvedConfig>;
49
- /**
50
- * The environment context associated with this plugin context
51
- *
52
- * @internal
53
- */
54
- environment: UNSAFE_EnvironmentContext<TResolvedConfig>;
55
- /**
56
- * Call a hook within the Powerlines system
57
- *
58
- * @internal
59
- *
60
- * @param hook - The name of the hook to call
61
- * @param options - Options for calling the hook
62
- * @param args - Arguments to pass to the hook
63
- * @returns The result of the hook call
64
- */
65
- callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
66
- environment?: string | EnvironmentContext<TResolvedConfig>;
67
- }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
68
- /**
69
- * A place to store internal data for the plugin context
70
- *
71
- * @internal
72
- */
73
- meta: Record<string, any>;
74
- }
75
- /**
76
- * An internal representation of the plugin context, used for managing hooks and environment data.
77
- *
78
- * @internal
79
- */
80
- interface UNSAFE_PluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PluginContext<TResolvedConfig> {
81
- $$internal: UNSAFE_PluginContextInternal<TResolvedConfig>;
82
- }
83
- //#endregion
84
- export { UNSAFE_PluginContext };
85
- //# sourceMappingURL=_internal.d.mts.map