@powerlines/plugin-unbuild 0.5.29 → 0.5.30

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.
@@ -3,7 +3,6 @@ import { EnvPaths } from '@stryke/env/get-env-paths';
3
3
  import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
4
4
  import { PackageJson } from '@stryke/types/package-json';
5
5
  import { Jiti } from 'jiti';
6
- import { ParserOptions, ParseResult } from 'oxc-parser';
7
6
  import { Range } from 'semver';
8
7
  import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
9
8
  import { Format } from '@storm-software/build-tools/types';
@@ -12,11 +11,10 @@ import { StormWorkspaceConfig } from '@storm-software/config/types';
12
11
  import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
13
12
  import { AssetGlob } from '@stryke/types/file';
14
13
  import { PreviewOptions, ResolvedPreviewOptions } from 'vite';
14
+ import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
15
15
  import { ArrayValues } from '@stryke/types/array';
16
16
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
17
17
  import ts from 'typescript';
18
- import { PrimitiveJsonValue } from '@stryke/json/types';
19
- import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
20
18
 
21
19
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
22
20
  interface BuildConfig {
@@ -156,87 +154,20 @@ type BuildResolvedConfig = Omit<BuildConfig, "override">;
156
154
  type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
157
155
  type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
158
156
 
159
- type ReflectionMode = "default" | "explicit" | "never";
160
- type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
161
- /**
162
- * Defines the level of reflection to be used during the transpilation process.
163
- *
164
- * @remarks
165
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
166
- * - `minimal` - Only the essential type information is captured.
167
- * - `normal` - Additional type information is captured, including some contextual data.
168
- * - `verbose` - All available type information is captured, including detailed contextual data.
169
- */
170
- type ReflectionLevel = "minimal" | "normal" | "verbose";
171
- interface DeepkitOptions {
172
- /**
173
- * Either true to activate reflection for all files compiled using this tsconfig,
174
- * or a list of globs/file paths relative to this tsconfig.json.
175
- * Globs/file paths can be prefixed with a ! to exclude them.
176
- */
177
- reflection?: RawReflectionMode;
178
- /**
179
- * Defines the level of reflection to be used during the transpilation process.
180
- *
181
- * @remarks
182
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
183
- * - `minimal` - Only the essential type information is captured.
184
- * - `normal` - Additional type information is captured, including some contextual data.
185
- * - `verbose` - All available type information is captured, including detailed contextual data.
186
- */
187
- reflectionLevel?: ReflectionLevel;
188
- }
189
- type TSCompilerOptions = CompilerOptions & DeepkitOptions;
190
- /**
191
- * The TypeScript compiler configuration.
192
- *
193
- * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
194
- */
195
- interface TSConfig extends Omit<TsConfigJson, "reflection"> {
196
- /**
197
- * Either true to activate reflection for all files compiled using this tsconfig,
198
- * or a list of globs/file paths relative to this tsconfig.json.
199
- * Globs/file paths can be prefixed with a ! to exclude them.
200
- */
201
- reflection?: RawReflectionMode;
202
- /**
203
- * Defines the level of reflection to be used during the transpilation process.
204
- *
205
- * @remarks
206
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
207
- * - `minimal` - Only the essential type information is captured.
208
- * - `normal` - Additional type information is captured, including some contextual data.
209
- * - `verbose` - All available type information is captured, including detailed contextual data.
210
- */
211
- reflectionLevel?: ReflectionLevel;
212
- /**
213
- * Instructs the TypeScript compiler how to compile `.ts` files.
214
- */
215
- compilerOptions?: TSCompilerOptions;
216
- }
217
- type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
218
- originalTsconfigJson: TsConfigJson;
219
- tsconfigJson: TSConfig;
220
- tsconfigFilePath: string;
221
- };
222
-
223
157
  declare const __VFS_PATCH__ = "__VFS_PATCH__";
224
158
  declare const __VFS_REVERT__ = "__VFS_REVERT__";
225
159
  type OutputModeType = "fs" | "virtual";
226
- interface VirtualFile {
160
+ interface VirtualFileMetadata {
227
161
  /**
228
- * The unique identifier for the virtual file.
229
- *
230
- * @remarks
231
- * If no specific id is provided, it defaults to the file's {@link path}.
162
+ * The identifier for the file data.
232
163
  */
233
164
  id: string;
234
165
  /**
235
- * Additional metadata associated with the virtual file.
166
+ * The timestamp of the virtual file.
236
167
  */
237
- details: Record<string, PrimitiveJsonValue>;
168
+ timestamp: number;
238
169
  /**
239
- * The variant of the file.
170
+ * The type of the file.
240
171
  *
241
172
  * @remarks
242
173
  * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
@@ -244,52 +175,72 @@ interface VirtualFile {
244
175
  * - `entry`: Indicates that the file is an entry point for execution.
245
176
  * - `normal`: Indicates that the file is a standard file without any special role.
246
177
  */
247
- variant: string;
178
+ type: string;
248
179
  /**
249
180
  * The output mode of the file.
250
- *
251
- * @remarks
252
- * This indicates whether the file is intended to be written to the actual file system (`fs`) or kept in the virtual file system (`virtual`).
253
181
  */
254
- mode: OutputModeType;
255
- /**
256
- * A virtual (or actual) path to the file in the file system.
257
- */
258
- path: string;
182
+ mode: string;
259
183
  /**
260
- * The contents of the file.
184
+ * Additional metadata associated with the file.
261
185
  */
262
- code: string | NodeJS.ArrayBufferView;
186
+ properties: Record<string, string>;
263
187
  }
264
- interface VirtualFileMetadata {
188
+ interface VirtualFileData {
265
189
  /**
266
190
  * The identifier for the file data.
267
191
  */
268
- id: string;
192
+ id?: string;
269
193
  /**
270
- * The variant of the file.
194
+ * The contents of the virtual file.
195
+ */
196
+ code: string;
197
+ /**
198
+ * The type of the file.
199
+ *
200
+ * @remarks
201
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
202
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
203
+ * - `entry`: Indicates that the file is an entry point for execution.
204
+ * - `chunk`: Indicates that the file is a code chunk, typically used in code-splitting scenarios.
205
+ * - `prebuilt-chunk`: Indicates that the file is a prebuilt code chunk.
206
+ * - `asset`: Indicates that the file is a static asset, such as an image or stylesheet.
207
+ * - `normal`: Indicates that the file is a standard file without any special role.
271
208
  */
272
- variant: string;
209
+ type?: string;
273
210
  /**
274
211
  * The output mode of the file.
275
212
  */
276
- mode: string;
213
+ mode?: string;
277
214
  /**
278
215
  * Additional metadata associated with the file.
279
216
  */
280
- properties: Record<string, string>;
217
+ properties?: Record<string, string>;
218
+ }
219
+ interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
220
+ /**
221
+ * An additional name for the file.
222
+ */
223
+ path: string;
224
+ /**
225
+ * The timestamp of the virtual file.
226
+ */
227
+ timestamp: number;
281
228
  }
282
229
  interface ResolveFSOptions {
283
230
  mode?: OutputModeType;
284
231
  }
285
232
  type MakeDirectoryOptions = (Mode | MakeDirectoryOptions$1) & ResolveFSOptions;
286
233
  interface PowerlinesWriteFileOptions extends ResolveFSOptions {
234
+ /**
235
+ * Should the file skip formatting before being written?
236
+ *
237
+ * @defaultValue false
238
+ */
287
239
  skipFormat?: boolean;
288
240
  }
289
241
  type NodeWriteFileOptions = WriteFileOptions$1;
290
242
  type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
291
- type PowerLinesWriteFileData = Partial<Omit<VirtualFile, "path" | "mode" | "code">> & Pick<VirtualFile, "code">;
292
- type WriteFileData = string | NodeJS.ArrayBufferView | PowerLinesWriteFileData;
243
+ type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
293
244
  interface ResolvePathOptions extends ResolveFSOptions {
294
245
  /**
295
246
  * Should the resolved path include the file extension?
@@ -304,7 +255,7 @@ interface ResolvePathOptions extends ResolveFSOptions {
304
255
  /**
305
256
  * The type of the path to resolve.
306
257
  */
307
- type?: "file" | "directory";
258
+ pathType?: "file" | "directory";
308
259
  }
309
260
  interface VirtualFileSystemInterface {
310
261
  /**
@@ -593,6 +544,70 @@ interface VirtualFileSystemInterface {
593
544
  dispose: () => Promise<void>;
594
545
  }
595
546
 
547
+ type ReflectionMode = "default" | "explicit" | "never";
548
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
549
+ /**
550
+ * Defines the level of reflection to be used during the transpilation process.
551
+ *
552
+ * @remarks
553
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
554
+ * - `minimal` - Only the essential type information is captured.
555
+ * - `normal` - Additional type information is captured, including some contextual data.
556
+ * - `verbose` - All available type information is captured, including detailed contextual data.
557
+ */
558
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
559
+ interface DeepkitOptions {
560
+ /**
561
+ * Either true to activate reflection for all files compiled using this tsconfig,
562
+ * or a list of globs/file paths relative to this tsconfig.json.
563
+ * Globs/file paths can be prefixed with a ! to exclude them.
564
+ */
565
+ reflection?: RawReflectionMode;
566
+ /**
567
+ * Defines the level of reflection to be used during the transpilation process.
568
+ *
569
+ * @remarks
570
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
571
+ * - `minimal` - Only the essential type information is captured.
572
+ * - `normal` - Additional type information is captured, including some contextual data.
573
+ * - `verbose` - All available type information is captured, including detailed contextual data.
574
+ */
575
+ reflectionLevel?: ReflectionLevel;
576
+ }
577
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
578
+ /**
579
+ * The TypeScript compiler configuration.
580
+ *
581
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
582
+ */
583
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
584
+ /**
585
+ * Either true to activate reflection for all files compiled using this tsconfig,
586
+ * or a list of globs/file paths relative to this tsconfig.json.
587
+ * Globs/file paths can be prefixed with a ! to exclude them.
588
+ */
589
+ reflection?: RawReflectionMode;
590
+ /**
591
+ * Defines the level of reflection to be used during the transpilation process.
592
+ *
593
+ * @remarks
594
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
595
+ * - `minimal` - Only the essential type information is captured.
596
+ * - `normal` - Additional type information is captured, including some contextual data.
597
+ * - `verbose` - All available type information is captured, including detailed contextual data.
598
+ */
599
+ reflectionLevel?: ReflectionLevel;
600
+ /**
601
+ * Instructs the TypeScript compiler how to compile `.ts` files.
602
+ */
603
+ compilerOptions?: TSCompilerOptions;
604
+ }
605
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
606
+ originalTsconfigJson: TsConfigJson;
607
+ tsconfigJson: TSConfig;
608
+ tsconfigFilePath: string;
609
+ };
610
+
596
611
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
597
612
  /**
598
613
  * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
@@ -1142,7 +1157,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1142
1157
  * @param path - An optional path to write the builtin file to
1143
1158
  * @param options - Options for writing the file
1144
1159
  */
1145
- writeBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1160
+ emitBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1146
1161
  /**
1147
1162
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1148
1163
  *
@@ -1150,11 +1165,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1150
1165
  * @param path - An optional path to write the entry file to
1151
1166
  * @param options - Options for writing the file
1152
1167
  */
1153
- writeEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1154
- /**
1155
- * Parses the source code and returns a {@link ParseResult} object.
1156
- */
1157
- parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
1168
+ emitEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1158
1169
  /**
1159
1170
  * A function to update the context fields using a new user configuration options
1160
1171
  */
@@ -1376,6 +1387,12 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1376
1387
  resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
1377
1388
  isEntry: boolean;
1378
1389
  }) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
1390
+ /**
1391
+ * An API object that can be used for inter-plugin communication.
1392
+ *
1393
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
1394
+ */
1395
+ api?: Record<string, any>;
1379
1396
  };
1380
1397
  type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = {
1381
1398
  [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant>;
@@ -3,7 +3,6 @@ import { EnvPaths } from '@stryke/env/get-env-paths';
3
3
  import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
4
4
  import { PackageJson } from '@stryke/types/package-json';
5
5
  import { Jiti } from 'jiti';
6
- import { ParserOptions, ParseResult } from 'oxc-parser';
7
6
  import { Range } from 'semver';
8
7
  import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
9
8
  import { Format } from '@storm-software/build-tools/types';
@@ -12,11 +11,10 @@ import { StormWorkspaceConfig } from '@storm-software/config/types';
12
11
  import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
13
12
  import { AssetGlob } from '@stryke/types/file';
14
13
  import { PreviewOptions, ResolvedPreviewOptions } from 'vite';
14
+ import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
15
15
  import { ArrayValues } from '@stryke/types/array';
16
16
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
17
17
  import ts from 'typescript';
18
- import { PrimitiveJsonValue } from '@stryke/json/types';
19
- import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
20
18
 
21
19
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
22
20
  interface BuildConfig {
@@ -156,87 +154,20 @@ type BuildResolvedConfig = Omit<BuildConfig, "override">;
156
154
  type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
157
155
  type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
158
156
 
159
- type ReflectionMode = "default" | "explicit" | "never";
160
- type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
161
- /**
162
- * Defines the level of reflection to be used during the transpilation process.
163
- *
164
- * @remarks
165
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
166
- * - `minimal` - Only the essential type information is captured.
167
- * - `normal` - Additional type information is captured, including some contextual data.
168
- * - `verbose` - All available type information is captured, including detailed contextual data.
169
- */
170
- type ReflectionLevel = "minimal" | "normal" | "verbose";
171
- interface DeepkitOptions {
172
- /**
173
- * Either true to activate reflection for all files compiled using this tsconfig,
174
- * or a list of globs/file paths relative to this tsconfig.json.
175
- * Globs/file paths can be prefixed with a ! to exclude them.
176
- */
177
- reflection?: RawReflectionMode;
178
- /**
179
- * Defines the level of reflection to be used during the transpilation process.
180
- *
181
- * @remarks
182
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
183
- * - `minimal` - Only the essential type information is captured.
184
- * - `normal` - Additional type information is captured, including some contextual data.
185
- * - `verbose` - All available type information is captured, including detailed contextual data.
186
- */
187
- reflectionLevel?: ReflectionLevel;
188
- }
189
- type TSCompilerOptions = CompilerOptions & DeepkitOptions;
190
- /**
191
- * The TypeScript compiler configuration.
192
- *
193
- * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
194
- */
195
- interface TSConfig extends Omit<TsConfigJson, "reflection"> {
196
- /**
197
- * Either true to activate reflection for all files compiled using this tsconfig,
198
- * or a list of globs/file paths relative to this tsconfig.json.
199
- * Globs/file paths can be prefixed with a ! to exclude them.
200
- */
201
- reflection?: RawReflectionMode;
202
- /**
203
- * Defines the level of reflection to be used during the transpilation process.
204
- *
205
- * @remarks
206
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
207
- * - `minimal` - Only the essential type information is captured.
208
- * - `normal` - Additional type information is captured, including some contextual data.
209
- * - `verbose` - All available type information is captured, including detailed contextual data.
210
- */
211
- reflectionLevel?: ReflectionLevel;
212
- /**
213
- * Instructs the TypeScript compiler how to compile `.ts` files.
214
- */
215
- compilerOptions?: TSCompilerOptions;
216
- }
217
- type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
218
- originalTsconfigJson: TsConfigJson;
219
- tsconfigJson: TSConfig;
220
- tsconfigFilePath: string;
221
- };
222
-
223
157
  declare const __VFS_PATCH__ = "__VFS_PATCH__";
224
158
  declare const __VFS_REVERT__ = "__VFS_REVERT__";
225
159
  type OutputModeType = "fs" | "virtual";
226
- interface VirtualFile {
160
+ interface VirtualFileMetadata {
227
161
  /**
228
- * The unique identifier for the virtual file.
229
- *
230
- * @remarks
231
- * If no specific id is provided, it defaults to the file's {@link path}.
162
+ * The identifier for the file data.
232
163
  */
233
164
  id: string;
234
165
  /**
235
- * Additional metadata associated with the virtual file.
166
+ * The timestamp of the virtual file.
236
167
  */
237
- details: Record<string, PrimitiveJsonValue>;
168
+ timestamp: number;
238
169
  /**
239
- * The variant of the file.
170
+ * The type of the file.
240
171
  *
241
172
  * @remarks
242
173
  * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
@@ -244,52 +175,72 @@ interface VirtualFile {
244
175
  * - `entry`: Indicates that the file is an entry point for execution.
245
176
  * - `normal`: Indicates that the file is a standard file without any special role.
246
177
  */
247
- variant: string;
178
+ type: string;
248
179
  /**
249
180
  * The output mode of the file.
250
- *
251
- * @remarks
252
- * This indicates whether the file is intended to be written to the actual file system (`fs`) or kept in the virtual file system (`virtual`).
253
181
  */
254
- mode: OutputModeType;
255
- /**
256
- * A virtual (or actual) path to the file in the file system.
257
- */
258
- path: string;
182
+ mode: string;
259
183
  /**
260
- * The contents of the file.
184
+ * Additional metadata associated with the file.
261
185
  */
262
- code: string | NodeJS.ArrayBufferView;
186
+ properties: Record<string, string>;
263
187
  }
264
- interface VirtualFileMetadata {
188
+ interface VirtualFileData {
265
189
  /**
266
190
  * The identifier for the file data.
267
191
  */
268
- id: string;
192
+ id?: string;
269
193
  /**
270
- * The variant of the file.
194
+ * The contents of the virtual file.
195
+ */
196
+ code: string;
197
+ /**
198
+ * The type of the file.
199
+ *
200
+ * @remarks
201
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
202
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
203
+ * - `entry`: Indicates that the file is an entry point for execution.
204
+ * - `chunk`: Indicates that the file is a code chunk, typically used in code-splitting scenarios.
205
+ * - `prebuilt-chunk`: Indicates that the file is a prebuilt code chunk.
206
+ * - `asset`: Indicates that the file is a static asset, such as an image or stylesheet.
207
+ * - `normal`: Indicates that the file is a standard file without any special role.
271
208
  */
272
- variant: string;
209
+ type?: string;
273
210
  /**
274
211
  * The output mode of the file.
275
212
  */
276
- mode: string;
213
+ mode?: string;
277
214
  /**
278
215
  * Additional metadata associated with the file.
279
216
  */
280
- properties: Record<string, string>;
217
+ properties?: Record<string, string>;
218
+ }
219
+ interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
220
+ /**
221
+ * An additional name for the file.
222
+ */
223
+ path: string;
224
+ /**
225
+ * The timestamp of the virtual file.
226
+ */
227
+ timestamp: number;
281
228
  }
282
229
  interface ResolveFSOptions {
283
230
  mode?: OutputModeType;
284
231
  }
285
232
  type MakeDirectoryOptions = (Mode | MakeDirectoryOptions$1) & ResolveFSOptions;
286
233
  interface PowerlinesWriteFileOptions extends ResolveFSOptions {
234
+ /**
235
+ * Should the file skip formatting before being written?
236
+ *
237
+ * @defaultValue false
238
+ */
287
239
  skipFormat?: boolean;
288
240
  }
289
241
  type NodeWriteFileOptions = WriteFileOptions$1;
290
242
  type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
291
- type PowerLinesWriteFileData = Partial<Omit<VirtualFile, "path" | "mode" | "code">> & Pick<VirtualFile, "code">;
292
- type WriteFileData = string | NodeJS.ArrayBufferView | PowerLinesWriteFileData;
243
+ type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
293
244
  interface ResolvePathOptions extends ResolveFSOptions {
294
245
  /**
295
246
  * Should the resolved path include the file extension?
@@ -304,7 +255,7 @@ interface ResolvePathOptions extends ResolveFSOptions {
304
255
  /**
305
256
  * The type of the path to resolve.
306
257
  */
307
- type?: "file" | "directory";
258
+ pathType?: "file" | "directory";
308
259
  }
309
260
  interface VirtualFileSystemInterface {
310
261
  /**
@@ -593,6 +544,70 @@ interface VirtualFileSystemInterface {
593
544
  dispose: () => Promise<void>;
594
545
  }
595
546
 
547
+ type ReflectionMode = "default" | "explicit" | "never";
548
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
549
+ /**
550
+ * Defines the level of reflection to be used during the transpilation process.
551
+ *
552
+ * @remarks
553
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
554
+ * - `minimal` - Only the essential type information is captured.
555
+ * - `normal` - Additional type information is captured, including some contextual data.
556
+ * - `verbose` - All available type information is captured, including detailed contextual data.
557
+ */
558
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
559
+ interface DeepkitOptions {
560
+ /**
561
+ * Either true to activate reflection for all files compiled using this tsconfig,
562
+ * or a list of globs/file paths relative to this tsconfig.json.
563
+ * Globs/file paths can be prefixed with a ! to exclude them.
564
+ */
565
+ reflection?: RawReflectionMode;
566
+ /**
567
+ * Defines the level of reflection to be used during the transpilation process.
568
+ *
569
+ * @remarks
570
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
571
+ * - `minimal` - Only the essential type information is captured.
572
+ * - `normal` - Additional type information is captured, including some contextual data.
573
+ * - `verbose` - All available type information is captured, including detailed contextual data.
574
+ */
575
+ reflectionLevel?: ReflectionLevel;
576
+ }
577
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
578
+ /**
579
+ * The TypeScript compiler configuration.
580
+ *
581
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
582
+ */
583
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
584
+ /**
585
+ * Either true to activate reflection for all files compiled using this tsconfig,
586
+ * or a list of globs/file paths relative to this tsconfig.json.
587
+ * Globs/file paths can be prefixed with a ! to exclude them.
588
+ */
589
+ reflection?: RawReflectionMode;
590
+ /**
591
+ * Defines the level of reflection to be used during the transpilation process.
592
+ *
593
+ * @remarks
594
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
595
+ * - `minimal` - Only the essential type information is captured.
596
+ * - `normal` - Additional type information is captured, including some contextual data.
597
+ * - `verbose` - All available type information is captured, including detailed contextual data.
598
+ */
599
+ reflectionLevel?: ReflectionLevel;
600
+ /**
601
+ * Instructs the TypeScript compiler how to compile `.ts` files.
602
+ */
603
+ compilerOptions?: TSCompilerOptions;
604
+ }
605
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
606
+ originalTsconfigJson: TsConfigJson;
607
+ tsconfigJson: TSConfig;
608
+ tsconfigFilePath: string;
609
+ };
610
+
596
611
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
597
612
  /**
598
613
  * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
@@ -1142,7 +1157,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1142
1157
  * @param path - An optional path to write the builtin file to
1143
1158
  * @param options - Options for writing the file
1144
1159
  */
1145
- writeBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1160
+ emitBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1146
1161
  /**
1147
1162
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1148
1163
  *
@@ -1150,11 +1165,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1150
1165
  * @param path - An optional path to write the entry file to
1151
1166
  * @param options - Options for writing the file
1152
1167
  */
1153
- writeEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1154
- /**
1155
- * Parses the source code and returns a {@link ParseResult} object.
1156
- */
1157
- parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
1168
+ emitEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
1158
1169
  /**
1159
1170
  * A function to update the context fields using a new user configuration options
1160
1171
  */
@@ -1376,6 +1387,12 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1376
1387
  resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
1377
1388
  isEntry: boolean;
1378
1389
  }) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
1390
+ /**
1391
+ * An API object that can be used for inter-plugin communication.
1392
+ *
1393
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
1394
+ */
1395
+ api?: Record<string, any>;
1379
1396
  };
1380
1397
  type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = {
1381
1398
  [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant>;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,10 @@
1
- import { U as UnbuildPluginContext, a as UnbuildPluginOptions, P as Plugin } from './index-Bvi0dz6Z.cjs';
2
- export { b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from './index-Bvi0dz6Z.cjs';
1
+ import { U as UnbuildPluginContext, a as UnbuildPluginOptions, P as Plugin } from './index-Czl5n8cY.cjs';
2
+ export { b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from './index-Czl5n8cY.cjs';
3
3
  import '@storm-software/unbuild/types';
4
4
  import '@stryke/env/get-env-paths';
5
5
  import '@stryke/types/base';
6
6
  import '@stryke/types/package-json';
7
7
  import 'jiti';
8
- import 'oxc-parser';
9
8
  import 'semver';
10
9
  import 'unplugin';
11
10
  import '@storm-software/build-tools/types';
@@ -14,11 +13,10 @@ import '@storm-software/config/types';
14
13
  import '@stryke/types/configuration';
15
14
  import '@stryke/types/file';
16
15
  import 'vite';
16
+ import 'node:fs';
17
17
  import '@stryke/types/array';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
- import '@stryke/json/types';
21
- import 'node:fs';
22
20
 
23
21
  /**
24
22
  * A Powerlines plugin to build projects using Unbuild.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { U as UnbuildPluginContext, a as UnbuildPluginOptions, P as Plugin } from './index-Bvi0dz6Z.js';
2
- export { b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from './index-Bvi0dz6Z.js';
1
+ import { U as UnbuildPluginContext, a as UnbuildPluginOptions, P as Plugin } from './index-Czl5n8cY.js';
2
+ export { b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from './index-Czl5n8cY.js';
3
3
  import '@storm-software/unbuild/types';
4
4
  import '@stryke/env/get-env-paths';
5
5
  import '@stryke/types/base';
6
6
  import '@stryke/types/package-json';
7
7
  import 'jiti';
8
- import 'oxc-parser';
9
8
  import 'semver';
10
9
  import 'unplugin';
11
10
  import '@storm-software/build-tools/types';
@@ -14,11 +13,10 @@ import '@storm-software/config/types';
14
13
  import '@stryke/types/configuration';
15
14
  import '@stryke/types/file';
16
15
  import 'vite';
16
+ import 'node:fs';
17
17
  import '@stryke/types/array';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
- import '@stryke/json/types';
21
- import 'node:fs';
22
20
 
23
21
  /**
24
22
  * A Powerlines plugin to build projects using Unbuild.
@@ -1,10 +1,9 @@
1
- export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Bvi0dz6Z.cjs';
1
+ export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Czl5n8cY.cjs';
2
2
  import '@storm-software/unbuild/types';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
- import 'oxc-parser';
8
7
  import 'semver';
9
8
  import 'unplugin';
10
9
  import '@storm-software/build-tools/types';
@@ -13,8 +12,7 @@ import '@storm-software/config/types';
13
12
  import '@stryke/types/configuration';
14
13
  import '@stryke/types/file';
15
14
  import 'vite';
15
+ import 'node:fs';
16
16
  import '@stryke/types/array';
17
17
  import '@stryke/types/tsconfig';
18
18
  import 'typescript';
19
- import '@stryke/json/types';
20
- import 'node:fs';
@@ -1,10 +1,9 @@
1
- export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Bvi0dz6Z.js';
1
+ export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Czl5n8cY.js';
2
2
  import '@storm-software/unbuild/types';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
- import 'oxc-parser';
8
7
  import 'semver';
9
8
  import 'unplugin';
10
9
  import '@storm-software/build-tools/types';
@@ -13,8 +12,7 @@ import '@storm-software/config/types';
13
12
  import '@stryke/types/configuration';
14
13
  import '@stryke/types/file';
15
14
  import 'vite';
15
+ import 'node:fs';
16
16
  import '@stryke/types/array';
17
17
  import '@stryke/types/tsconfig';
18
18
  import 'typescript';
19
- import '@stryke/json/types';
20
- import 'node:fs';
@@ -1,10 +1,9 @@
1
- export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Bvi0dz6Z.cjs';
1
+ export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Czl5n8cY.cjs';
2
2
  import '@storm-software/unbuild/types';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
- import 'oxc-parser';
8
7
  import 'semver';
9
8
  import 'unplugin';
10
9
  import '@storm-software/build-tools/types';
@@ -13,8 +12,7 @@ import '@storm-software/config/types';
13
12
  import '@stryke/types/configuration';
14
13
  import '@stryke/types/file';
15
14
  import 'vite';
15
+ import 'node:fs';
16
16
  import '@stryke/types/array';
17
17
  import '@stryke/types/tsconfig';
18
18
  import 'typescript';
19
- import '@stryke/json/types';
20
- import 'node:fs';
@@ -1,10 +1,9 @@
1
- export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Bvi0dz6Z.js';
1
+ export { U as UnbuildPluginContext, a as UnbuildPluginOptions, b as UnbuildPluginResolvedConfig, d as __ΩUnbuildPluginContext, _ as __ΩUnbuildPluginOptions, c as __ΩUnbuildPluginResolvedConfig } from '../index-Czl5n8cY.js';
2
2
  import '@storm-software/unbuild/types';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
- import 'oxc-parser';
8
7
  import 'semver';
9
8
  import 'unplugin';
10
9
  import '@storm-software/build-tools/types';
@@ -13,8 +12,7 @@ import '@storm-software/config/types';
13
12
  import '@stryke/types/configuration';
14
13
  import '@stryke/types/file';
15
14
  import 'vite';
15
+ import 'node:fs';
16
16
  import '@stryke/types/array';
17
17
  import '@stryke/types/tsconfig';
18
18
  import 'typescript';
19
- import '@stryke/json/types';
20
- import 'node:fs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-unbuild",
3
- "version": "0.5.29",
3
+ "version": "0.5.30",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to build projects using Unbuild.",
6
6
  "repository": {
@@ -127,21 +127,21 @@
127
127
  "files": ["dist/**/*"],
128
128
  "keywords": ["unbuild", "powerlines", "storm-software", "powerlines-plugin"],
129
129
  "dependencies": {
130
- "@storm-software/unbuild": "^0.57.42",
130
+ "@storm-software/unbuild": "^0.57.47",
131
131
  "@stryke/fs": "^0.32.13",
132
132
  "@stryke/path": "^0.19.2",
133
133
  "@stryke/type-checks": "^0.3.12",
134
134
  "@stryke/types": "^0.10.2",
135
135
  "defu": "^6.1.4",
136
136
  "jiti": "^2.6.1",
137
- "powerlines": "^0.23.3",
137
+ "powerlines": "^0.23.4",
138
138
  "unplugin": "^2.3.10"
139
139
  },
140
140
  "devDependencies": {
141
- "@powerlines/nx": "^0.10.20",
142
- "@powerlines/plugin-plugin": "^0.11.28",
141
+ "@powerlines/nx": "^0.10.21",
142
+ "@powerlines/plugin-plugin": "^0.11.29",
143
143
  "@types/node": "^24.10.1"
144
144
  },
145
145
  "publishConfig": { "access": "public" },
146
- "gitHead": "6e43200541ace2946694195c092642e7ac2f3098"
146
+ "gitHead": "3075c08893a66a4e8d359e37f8d0344b0a80322b"
147
147
  }