@powerlines/plugin-webpack 0.5.130 → 0.5.132

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 (130) hide show
  1. package/dist/helpers/index.cjs +3 -2
  2. package/dist/helpers/index.d.cts +3 -1
  3. package/dist/helpers/index.d.mts +3 -1
  4. package/dist/helpers/index.mjs +2 -1
  5. package/dist/helpers/unplugin.cjs +2 -11
  6. package/dist/helpers/unplugin.d.cts +2 -6
  7. package/dist/helpers/unplugin.d.mts +2 -6
  8. package/dist/helpers/unplugin.mjs +1 -9
  9. package/dist/helpers-B15z10jN.mjs +1 -0
  10. package/dist/helpers-LF26RHol.cjs +0 -0
  11. package/dist/index-9iG2qHLe.d.mts +1 -0
  12. package/dist/index-D4ELpJXS.d.cts +1 -0
  13. package/dist/index-D6CnpA_r.d.cts +1 -0
  14. package/dist/index-DL0uimUT.d.mts +1 -0
  15. package/dist/index.cjs +50 -8
  16. package/dist/index.d.cts +4 -3
  17. package/dist/index.d.mts +5 -5
  18. package/dist/index.mjs +46 -3
  19. package/dist/plugin-C5bG6Zu0.d.mts +1772 -0
  20. package/dist/plugin-Cl1J-dKa.d.cts +1769 -0
  21. package/dist/plugin-ifZVa20V.mjs +1 -0
  22. package/dist/plugin-pBKbb5K9.cjs +0 -0
  23. package/dist/types/index.cjs +2 -0
  24. package/dist/types/index.d.cts +2 -1
  25. package/dist/types/index.d.mts +2 -1
  26. package/dist/types/index.mjs +3 -0
  27. package/dist/types/plugin.cjs +1 -0
  28. package/dist/types/plugin.d.cts +1 -12
  29. package/dist/types/plugin.d.mts +1 -12
  30. package/dist/types/plugin.mjs +2 -0
  31. package/dist/types-U3zd8PTP.mjs +1 -0
  32. package/dist/types-o3zWarRp.cjs +0 -0
  33. package/dist/unplugin-Bo9KoKSB.d.cts +7 -0
  34. package/dist/unplugin-Ct4wZxE5.d.mts +7 -0
  35. package/dist/unplugin-GJmHohOE.mjs +4617 -0
  36. package/dist/unplugin-bKYETUU8.cjs +4661 -0
  37. package/package.json +5 -5
  38. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  39. package/dist/powerlines/schemas/fs.cjs +0 -226
  40. package/dist/powerlines/schemas/fs.mjs +0 -224
  41. package/dist/powerlines/src/api.cjs +0 -580
  42. package/dist/powerlines/src/api.mjs +0 -578
  43. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
  44. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
  45. package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
  46. package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
  47. package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
  48. package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
  49. package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -63
  50. package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -61
  51. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
  52. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
  53. package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
  54. package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
  55. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
  56. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
  57. package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
  58. package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
  59. package/dist/powerlines/src/lib/build/webpack.cjs +0 -47
  60. package/dist/powerlines/src/lib/build/webpack.mjs +0 -45
  61. package/dist/powerlines/src/lib/config-file.cjs +0 -79
  62. package/dist/powerlines/src/lib/config-file.mjs +0 -76
  63. package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
  64. package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
  65. package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
  66. package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
  67. package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
  68. package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
  69. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
  70. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
  71. package/dist/powerlines/src/lib/entry.cjs +0 -69
  72. package/dist/powerlines/src/lib/entry.mjs +0 -67
  73. package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
  74. package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
  75. package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
  76. package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
  77. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
  78. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
  79. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
  80. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
  81. package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
  82. package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
  83. package/dist/powerlines/src/lib/logger.cjs +0 -58
  84. package/dist/powerlines/src/lib/logger.mjs +0 -55
  85. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
  86. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
  87. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
  88. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
  89. package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
  90. package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
  91. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
  92. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
  93. package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
  94. package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
  95. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
  96. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
  97. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  98. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  99. package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
  100. package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
  101. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
  102. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
  103. package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -148
  104. package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
  105. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
  106. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
  107. package/dist/powerlines/src/types/babel.d.mts +0 -4
  108. package/dist/powerlines/src/types/build.cjs +0 -15
  109. package/dist/powerlines/src/types/build.d.cts +0 -149
  110. package/dist/powerlines/src/types/build.d.mts +0 -149
  111. package/dist/powerlines/src/types/build.mjs +0 -14
  112. package/dist/powerlines/src/types/commands.cjs +0 -16
  113. package/dist/powerlines/src/types/commands.d.cts +0 -8
  114. package/dist/powerlines/src/types/commands.d.mts +0 -9
  115. package/dist/powerlines/src/types/commands.mjs +0 -15
  116. package/dist/powerlines/src/types/config.d.cts +0 -370
  117. package/dist/powerlines/src/types/config.d.mts +0 -372
  118. package/dist/powerlines/src/types/context.d.cts +0 -403
  119. package/dist/powerlines/src/types/context.d.mts +0 -405
  120. package/dist/powerlines/src/types/fs.d.cts +0 -486
  121. package/dist/powerlines/src/types/fs.d.mts +0 -486
  122. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  123. package/dist/powerlines/src/types/plugin.cjs +0 -32
  124. package/dist/powerlines/src/types/plugin.d.cts +0 -231
  125. package/dist/powerlines/src/types/plugin.d.mts +0 -231
  126. package/dist/powerlines/src/types/plugin.mjs +0 -31
  127. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  128. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  129. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  130. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
@@ -1,405 +0,0 @@
1
- import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.mjs";
2
- import { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition } from "./resolved.mjs";
3
- import "./plugin.mjs";
4
- import { ParsedTypeScriptConfig } from "./tsconfig.mjs";
5
- import { InlineConfig, LogFn, UserConfig, WorkspaceConfig } from "./config.mjs";
6
- import "./hooks.mjs";
7
- import { ExternalIdResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage } from "unplugin";
8
- import { Project } from "ts-morph";
9
- import { EnvPaths } from "@stryke/env/get-env-paths";
10
- import { FetchRequestOptions } from "@stryke/http/fetch";
11
- import { ParseResult, ParserOptions } from "oxc-parser";
12
- import { RequestInfo, Response } from "undici";
13
- import { Jiti } from "jiti";
14
- import { SourceMap } from "magic-string";
15
- import { NonUndefined } from "@stryke/types/base";
16
- import { PackageJson } from "@stryke/types/package-json";
17
- import { Range } from "semver";
18
-
19
- //#region ../powerlines/src/types/context.d.ts
20
-
21
- interface MetaInfo {
22
- /**
23
- * The checksum generated from the resolved options
24
- */
25
- checksum: string;
26
- /**
27
- * The build id
28
- */
29
- buildId: string;
30
- /**
31
- * The release id
32
- */
33
- releaseId: string;
34
- /**
35
- * The build timestamp
36
- */
37
- timestamp: number;
38
- /**
39
- * A hash that represents the path to the project root directory
40
- */
41
- projectRootHash: string;
42
- /**
43
- * A hash that represents the path to the project root directory
44
- */
45
- configHash: string;
46
- }
47
- interface Resolver extends Jiti {
48
- plugin: Jiti;
49
- }
50
- interface TransformResult$1 {
51
- code: string;
52
- map: SourceMap | null;
53
- }
54
- /**
55
- * Options for initializing or updating the context with new configuration values
56
- */
57
- interface InitContextOptions {
58
- /**
59
- * If false, the plugin will be loaded after all other plugins.
60
- *
61
- * @defaultValue true
62
- */
63
- isHighPriority: boolean;
64
- }
65
- /**
66
- * Options for fetch requests made via the context's {@link Context.fetch} method
67
- */
68
- interface FetchOptions extends FetchRequestOptions {
69
- /**
70
- * An indicator specifying that the request should bypass any caching
71
- */
72
- skipCache?: boolean;
73
- }
74
- /**
75
- * Options for parsing code using [Oxc-Parser](https://github.com/oxc/oxc)
76
- */
77
- interface ParseOptions extends ParserOptions {
78
- /**
79
- * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
80
- */
81
- allowReturnOutsideFunction?: boolean;
82
- }
83
- interface EmitOptions extends WriteOptions {
84
- /**
85
- * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
86
- */
87
- emitWithBundler?: boolean;
88
- needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
89
- originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
90
- }
91
- /**
92
- * Options for emitting entry virtual files
93
- */
94
- type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
95
- /**
96
- * The unresolved Powerlines context.
97
- *
98
- * @remarks
99
- * This context is used before the user configuration has been fully resolved after the `config`.
100
- */
101
- interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
102
- /**
103
- * The Storm workspace configuration
104
- */
105
- workspaceConfig: WorkspaceConfig;
106
- /**
107
- * An object containing the options provided to Powerlines
108
- */
109
- config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
110
- projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
111
- sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
112
- output: TResolvedConfig["output"];
113
- };
114
- /**
115
- * A logging function for the Powerlines engine
116
- */
117
- log: LogFn;
118
- /**
119
- * A logging function for fatal messages
120
- */
121
- fatal: (message: string | UnpluginMessage) => void;
122
- /**
123
- * A logging function for error messages
124
- */
125
- error: (message: string | UnpluginMessage) => void;
126
- /**
127
- * A logging function for warning messages
128
- */
129
- warn: (message: string | UnpluginMessage) => void;
130
- /**
131
- * A logging function for informational messages
132
- */
133
- info: (message: string | UnpluginMessage) => void;
134
- /**
135
- * A logging function for debug messages
136
- */
137
- debug: (message: string | UnpluginMessage) => void;
138
- /**
139
- * A logging function for trace messages
140
- */
141
- trace: (message: string | UnpluginMessage) => void;
142
- /**
143
- * The metadata information
144
- */
145
- meta: MetaInfo;
146
- /**
147
- * The metadata information currently written to disk
148
- */
149
- persistedMeta?: MetaInfo;
150
- /**
151
- * The Powerlines artifacts directory
152
- */
153
- artifactsPath: string;
154
- /**
155
- * The path to the Powerlines builtin runtime modules directory
156
- */
157
- builtinsPath: string;
158
- /**
159
- * The path to the Powerlines entry modules directory
160
- */
161
- entryPath: string;
162
- /**
163
- * The path to the Powerlines TypeScript declaration files directory
164
- */
165
- dtsPath: string;
166
- /**
167
- * The path to a directory where the reflection data buffers (used by the build processes) are stored
168
- */
169
- dataPath: string;
170
- /**
171
- * The path to a directory where the project cache (used by the build processes) is stored
172
- */
173
- cachePath: string;
174
- /**
175
- * The Powerlines environment paths
176
- */
177
- envPaths: EnvPaths;
178
- /**
179
- * The file system path to the Powerlines package installation
180
- */
181
- powerlinesPath: string;
182
- /**
183
- * The relative path to the Powerlines workspace root directory
184
- */
185
- relativeToWorkspaceRoot: string;
186
- /**
187
- * The project's `package.json` file content
188
- */
189
- packageJson: PackageJson & Record<string, any>;
190
- /**
191
- * The project's `project.json` file content
192
- */
193
- projectJson?: Record<string, any>;
194
- /**
195
- * The dependency installations required by the project
196
- */
197
- dependencies: Record<string, string | Range>;
198
- /**
199
- * The development dependency installations required by the project
200
- */
201
- devDependencies: Record<string, string | Range>;
202
- /**
203
- * The parsed TypeScript configuration from the `tsconfig.json` file
204
- */
205
- tsconfig: ParsedTypeScriptConfig;
206
- /**
207
- * The entry points of the source code
208
- */
209
- entry: ResolvedEntryTypeDefinition[];
210
- /**
211
- * The virtual file system manager used during the build process to reference generated runtime files
212
- */
213
- fs: VirtualFileSystemInterface;
214
- /**
215
- * The Jiti module resolver
216
- */
217
- resolver: Resolver;
218
- /**
219
- * The builtin module id that exist in the Powerlines virtual file system
220
- */
221
- builtins: string[];
222
- /**
223
- * The {@link Project} instance used for type reflection and module manipulation
224
- *
225
- * @see https://ts-morph.com/
226
- *
227
- * @remarks
228
- * This instance is created lazily on first access.
229
- */
230
- program: Project;
231
- /**
232
- * A function to perform HTTP fetch requests
233
- *
234
- * @remarks
235
- * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
236
- *
237
- * @example
238
- * ```ts
239
- * const response = await context.fetch("https://api.example.com/data");
240
- * const data = await response.json();
241
- * ```
242
- *
243
- * @see https://github.com/nodejs/undici
244
- *
245
- * @param input - The URL to fetch.
246
- * @param options - The fetch request options.
247
- * @returns A promise that resolves to a response returned by the fetch.
248
- */
249
- fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
250
- /**
251
- * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
252
- *
253
- * @remarks
254
- * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
255
- *
256
- * @example
257
- * ```ts
258
- * const ast = context.parse("const x: number = 42;");
259
- * ```
260
- *
261
- * @see https://rollupjs.org/plugin-development/#this-parse
262
- * @see https://github.com/oxc/oxc
263
- *
264
- * @param code - The source code to parse.
265
- * @param options - The options to pass to the parser.
266
- * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
267
- */
268
- parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
269
- /**
270
- * A helper function to resolve modules using the Jiti resolver
271
- *
272
- * @remarks
273
- * This function can be used to resolve modules relative to the project root directory.
274
- *
275
- * @example
276
- * ```ts
277
- * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
278
- * ```
279
- *
280
- * @param id - The module to resolve.
281
- * @param importer - An optional path to the importer module.
282
- * @param options - Additional resolution options.
283
- * @returns A promise that resolves to the resolved module path.
284
- */
285
- resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
286
- /**
287
- * A helper function to load modules using the Jiti resolver
288
- *
289
- * @remarks
290
- * This function can be used to load modules relative to the project root directory.
291
- *
292
- * @example
293
- * ```ts
294
- * const module = await context.load("some-module", "/path/to/importer");
295
- * ```
296
- *
297
- * @param id - The module to load.
298
- * @returns A promise that resolves to the loaded module.
299
- */
300
- load: (id: string) => Promise<TransformResult$1 | undefined>;
301
- /**
302
- * The Powerlines builtin virtual files
303
- */
304
- getBuiltins: () => Promise<VirtualFile[]>;
305
- /**
306
- * Resolves a file and writes it to the VFS if it does not already exist
307
- *
308
- * @param code - The source code of the file
309
- * @param path - The path to write the file to
310
- * @param options - Additional options for writing the file
311
- */
312
- emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
313
- /**
314
- * Synchronously resolves a file and writes it to the VFS if it does not already exist
315
- *
316
- * @param code - The source code of the file
317
- * @param path - The path to write the file to
318
- * @param options - Additional options for writing the file
319
- */
320
- emitSync: (code: string, path: string, options?: EmitOptions) => void;
321
- /**
322
- * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
323
- *
324
- * @param code - The source code of the builtin file
325
- * @param id - The unique identifier of the builtin file
326
- * @param path - An optional path to write the builtin file to
327
- * @param options - Additional options for writing the builtin file
328
- */
329
- emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
330
- /**
331
- * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
332
- *
333
- * @param code - The source code of the builtin file
334
- * @param id - The unique identifier of the builtin file
335
- * @param path - An optional path to write the builtin file to
336
- * @param options - Additional options for writing the builtin file
337
- */
338
- emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
339
- /**
340
- * Resolves a entry virtual file and writes it to the VFS if it does not already exist
341
- *
342
- * @param code - The source code of the entry file
343
- * @param path - An optional path to write the entry file to
344
- * @param options - Additional options for writing the entry file
345
- */
346
- emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
347
- /**
348
- * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
349
- *
350
- * @param code - The source code of the entry file
351
- * @param path - An optional path to write the entry file to
352
- * @param options - Additional options for writing the entry file
353
- */
354
- emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
355
- /**
356
- * A function to update the context fields using a new user configuration options
357
- */
358
- withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
359
- /**
360
- * A function to update the context fields using inline configuration options
361
- */
362
- withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
363
- /**
364
- * Create a new logger instance
365
- *
366
- * @param name - The name to use for the logger instance
367
- * @returns A logger function
368
- */
369
- createLog: (name: string | null) => LogFn;
370
- /**
371
- * Extend the current logger instance with a new name
372
- *
373
- * @param name - The name to use for the extended logger instance
374
- * @returns A logger function
375
- */
376
- extendLog: (name: string) => LogFn;
377
- /**
378
- * Generates a checksum representing the current context state
379
- *
380
- * @returns A promise that resolves to a string representing the checksum
381
- */
382
- generateChecksum: () => Promise<string>;
383
- }
384
- type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
385
- /**
386
- * The fully resolved Powerlines configuration
387
- */
388
- config: TResolvedConfig;
389
- };
390
- interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
391
- /**
392
- * The environment specific resolved configuration
393
- */
394
- environment: EnvironmentResolvedConfig;
395
- /**
396
- * An alternative property name for the {@link log} property
397
- *
398
- * @remarks
399
- * This is provided for compatibility with other logging libraries that expect a `logger` property.
400
- */
401
- logger: LogFn;
402
- }
403
- type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
404
- //#endregion
405
- export { BuildPluginContext, PluginContext, UnresolvedContext };