@powerlines/plugin-vite 0.14.20 → 0.14.22

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