@powerlines/plugin-babel 0.12.19 → 0.12.21

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,4 +1,4 @@
1
- import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-DNQSUN-t.cjs';
1
+ import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-CwYWLG3U.cjs';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  /**
26
24
  * Create a Babel plugin using the provided builder function.
@@ -1,4 +1,4 @@
1
- import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-DNQSUN-t.js';
1
+ import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-CwYWLG3U.js';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  /**
26
24
  * Create a Babel plugin using the provided builder function.
@@ -1,4 +1,4 @@
1
- import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-DNQSUN-t.cjs';
1
+ import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-CwYWLG3U.cjs';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  declare function getPluginName(plugin: BabelTransformPluginOptions): string | undefined;
26
24
  /**
@@ -1,4 +1,4 @@
1
- import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-DNQSUN-t.js';
1
+ import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-CwYWLG3U.js';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  declare function getPluginName(plugin: BabelTransformPluginOptions): string | undefined;
26
24
  /**
@@ -6,7 +6,7 @@ export { resolveBabelPlugin, resolvePluginFunction } from './options.cjs';
6
6
  export { GeneratorResult } from '@babel/generator';
7
7
  import '@babel/parser';
8
8
  import '@babel/types';
9
- import '../plugin-DNQSUN-t.cjs';
9
+ import '../plugin-CwYWLG3U.cjs';
10
10
  import '@stryke/types/base';
11
11
  import 'unplugin';
12
12
  import '@stryke/types/array';
@@ -26,6 +26,4 @@ import 'semver';
26
26
  import '@stryke/types/tsconfig';
27
27
  import 'typescript';
28
28
  import '@stryke/json/types';
29
- import 'memfs';
30
29
  import 'node:fs';
31
- import 'unionfs';
@@ -6,7 +6,7 @@ export { resolveBabelPlugin, resolvePluginFunction } from './options.js';
6
6
  export { GeneratorResult } from '@babel/generator';
7
7
  import '@babel/parser';
8
8
  import '@babel/types';
9
- import '../plugin-DNQSUN-t.js';
9
+ import '../plugin-CwYWLG3U.js';
10
10
  import '@stryke/types/base';
11
11
  import 'unplugin';
12
12
  import '@stryke/types/array';
@@ -26,6 +26,4 @@ import 'semver';
26
26
  import '@stryke/types/tsconfig';
27
27
  import 'typescript';
28
28
  import '@stryke/json/types';
29
- import 'memfs';
30
29
  import 'node:fs';
31
- import 'unionfs';
@@ -1,7 +1,7 @@
1
1
  import { NodePath } from '@babel/core';
2
2
  import { ParseResult } from '@babel/parser';
3
3
  import * as t from '@babel/types';
4
- import { I as ImportSpecifier } from '../plugin-DNQSUN-t.cjs';
4
+ import { I as ImportSpecifier } from '../plugin-CwYWLG3U.cjs';
5
5
  import '@stryke/types/base';
6
6
  import 'unplugin';
7
7
  import '@stryke/types/array';
@@ -20,9 +20,7 @@ import 'semver';
20
20
  import '@stryke/types/tsconfig';
21
21
  import 'typescript';
22
22
  import '@stryke/json/types';
23
- import 'memfs';
24
23
  import 'node:fs';
25
- import 'unionfs';
26
24
 
27
25
  /**
28
26
  * Finds an export in the given Babel AST program by its key.
@@ -1,7 +1,7 @@
1
1
  import { NodePath } from '@babel/core';
2
2
  import { ParseResult } from '@babel/parser';
3
3
  import * as t from '@babel/types';
4
- import { I as ImportSpecifier } from '../plugin-DNQSUN-t.js';
4
+ import { I as ImportSpecifier } from '../plugin-CwYWLG3U.js';
5
5
  import '@stryke/types/base';
6
6
  import 'unplugin';
7
7
  import '@stryke/types/array';
@@ -20,9 +20,7 @@ import 'semver';
20
20
  import '@stryke/types/tsconfig';
21
21
  import 'typescript';
22
22
  import '@stryke/json/types';
23
- import 'memfs';
24
23
  import 'node:fs';
25
- import 'unionfs';
26
24
 
27
25
  /**
28
26
  * Finds an export in the given Babel AST program by its key.
@@ -1,5 +1,5 @@
1
1
  import { PluginTarget, PluginOptions } from '@babel/core';
2
- import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-DNQSUN-t.cjs';
2
+ import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-CwYWLG3U.cjs';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
26
24
  /**
@@ -1,5 +1,5 @@
1
1
  import { PluginTarget, PluginOptions } from '@babel/core';
2
- import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-DNQSUN-t.js';
2
+ import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-CwYWLG3U.js';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
26
24
  /**
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as Plugin } from './plugin-DNQSUN-t.cjs';
1
+ import { P as Plugin } from './plugin-CwYWLG3U.cjs';
2
2
  import { BabelPluginOptions, BabelPluginContext } from './types/plugin.cjs';
3
3
  export { BabelPluginResolvedConfig, BabelPluginUserConfig } from './types/plugin.cjs';
4
4
  export { GenerateFromAstOptions, generateFromAst, parseAst } from './helpers/ast-utils.cjs';
@@ -26,9 +26,7 @@ import 'semver';
26
26
  import '@stryke/types/tsconfig';
27
27
  import 'typescript';
28
28
  import '@stryke/json/types';
29
- import 'memfs';
30
29
  import 'node:fs';
31
- import 'unionfs';
32
30
  import '@babel/parser';
33
31
  import '@babel/types';
34
32
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as Plugin } from './plugin-DNQSUN-t.js';
1
+ import { P as Plugin } from './plugin-CwYWLG3U.js';
2
2
  import { BabelPluginOptions, BabelPluginContext } from './types/plugin.js';
3
3
  export { BabelPluginResolvedConfig, BabelPluginUserConfig } from './types/plugin.js';
4
4
  export { GenerateFromAstOptions, generateFromAst, parseAst } from './helpers/ast-utils.js';
@@ -26,9 +26,7 @@ import 'semver';
26
26
  import '@stryke/types/tsconfig';
27
27
  import 'typescript';
28
28
  import '@stryke/json/types';
29
- import 'memfs';
30
29
  import 'node:fs';
31
- import 'unionfs';
32
30
  import '@babel/parser';
33
31
  import '@babel/types';
34
32
 
@@ -17,9 +17,7 @@ import { Range } from 'semver';
17
17
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
18
18
  import ts from 'typescript';
19
19
  import { PrimitiveJsonValue } from '@stryke/json/types';
20
- import { Volume } from 'memfs';
21
20
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
22
- import { IUnionFs } from 'unionfs';
23
21
 
24
22
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
25
23
  interface BuildConfig {
@@ -29,6 +27,20 @@ interface BuildConfig {
29
27
  * @defaultValue "neutral"
30
28
  */
31
29
  platform?: "node" | "browser" | "neutral";
30
+ /**
31
+ * Array of strings indicating the polyfills to include for the build.
32
+ *
33
+ * @remarks
34
+ * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * {
39
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
40
+ * }
41
+ * ```
42
+ */
43
+ polyfill?: string[];
32
44
  /**
33
45
  * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
34
46
  *
@@ -114,7 +126,10 @@ interface BuildConfig {
114
126
  *
115
127
  * @see https://github.com/rollup/plugins/tree/master/packages/alias
116
128
  */
117
- alias?: Record<string, string>;
129
+ alias?: Record<string, string> | Array<{
130
+ find: string | RegExp;
131
+ replacement: string;
132
+ }>;
118
133
  /**
119
134
  * A list of modules that should not be bundled, even if they are external dependencies.
120
135
  *
@@ -254,11 +269,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
254
269
  tsconfigFilePath: string;
255
270
  };
256
271
 
257
- declare const __VFS_INIT__ = "__VFS_INIT__";
258
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
259
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
260
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
261
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
272
+ declare const __VFS_PATCH__: unique symbol;
273
+ declare const __VFS_REVERT__: unique symbol;
262
274
  type OutputModeType = "fs" | "virtual";
263
275
  interface VirtualFile {
264
276
  /**
@@ -298,7 +310,24 @@ interface VirtualFile {
298
310
  */
299
311
  code: string | NodeJS.ArrayBufferView;
300
312
  }
301
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
313
+ interface VirtualFileMetadata {
314
+ /**
315
+ * The identifier for the file data.
316
+ */
317
+ id: string;
318
+ /**
319
+ * The variant of the file.
320
+ */
321
+ variant: string;
322
+ /**
323
+ * The output mode of the file.
324
+ */
325
+ mode: string;
326
+ /**
327
+ * Additional metadata associated with the file.
328
+ */
329
+ properties: Record<string, string>;
330
+ }
302
331
  interface ResolveFSOptions {
303
332
  mode?: OutputModeType;
304
333
  }
@@ -327,12 +356,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
327
356
  type?: "file" | "directory";
328
357
  }
329
358
  interface VirtualFileSystemInterface {
330
- [__VFS_INIT__]: () => void;
359
+ /**
360
+ * Patches the File System to include the virtual file system (VFS) contents.
361
+ */
362
+ [__VFS_PATCH__]: () => void;
363
+ /**
364
+ * Reverts the virtual file system (VFS) to its previous state.
365
+ */
331
366
  [__VFS_REVERT__]: () => void;
332
367
  /**
333
368
  * The underlying file metadata.
334
369
  */
335
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
370
+ metadata: Record<string, VirtualFileMetadata | undefined>;
336
371
  /**
337
372
  * A map of module ids to their file paths.
338
373
  */
@@ -352,7 +387,7 @@ interface VirtualFileSystemInterface {
352
387
  * @param options - Optional parameters for resolving the path.
353
388
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
354
389
  */
355
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
390
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
356
391
  /**
357
392
  * Checks if a file exists in the virtual file system (VFS).
358
393
  *
@@ -367,15 +402,6 @@ interface VirtualFileSystemInterface {
367
402
  * @returns `true` if the directory exists, otherwise `false`.
368
403
  */
369
404
  isDirectory: (path: string) => boolean;
370
- /**
371
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
372
- *
373
- * @see https://www.typescriptlang.org/tsconfig#paths
374
- *
375
- * @param pathOrId - The path or id to check.
376
- * @returns Whether the path or id corresponds to a virtual file.
377
- */
378
- isTsconfigPath: (pathOrId: string) => boolean;
379
405
  /**
380
406
  * Checks if a file exists in the virtual file system (VFS).
381
407
  *
@@ -389,7 +415,7 @@ interface VirtualFileSystemInterface {
389
415
  * @param pathOrId - The path or id of the file.
390
416
  * @returns The metadata of the file if it exists, otherwise undefined.
391
417
  */
392
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
418
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
393
419
  /**
394
420
  * Gets the stats of a file in the virtual file system (VFS).
395
421
  *
@@ -597,23 +623,12 @@ interface VirtualFileSystemInterface {
597
623
  */
598
624
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
599
625
  /**
600
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
601
- *
602
- * @see https://www.typescriptlang.org/tsconfig#paths
626
+ * Formats a path to match the virtual file system (VFS) structure.
603
627
  *
604
- * @param path - The path to check.
605
- * @returns The resolved file path if it exists, otherwise undefined.
628
+ * @param path - The path to format.
629
+ * @returns The formatted path.
606
630
  */
607
- resolveTsconfigPath: (path: string) => string | false;
608
- /**
609
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
610
- *
611
- * @see https://www.typescriptlang.org/tsconfig#paths
612
- *
613
- * @param path - The path to check.
614
- * @returns The resolved package name if it exists, otherwise undefined.
615
- */
616
- resolveTsconfigPathPackage: (path: string) => string | false;
631
+ formatPath: (path: string) => string;
617
632
  /**
618
633
  * Resolves a path or id to a file path in the virtual file system.
619
634
  *
@@ -622,23 +637,9 @@ interface VirtualFileSystemInterface {
622
637
  */
623
638
  realpathSync: (pathOrId: string) => string;
624
639
  /**
625
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
626
- *
627
- * @returns A record mapping file paths to their partial metadata.
628
- */
629
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
630
- /**
631
- * A map of cached file paths to their underlying file content.
632
- */
633
- [__VFS_CACHE__]: Map<string, string>;
634
- /**
635
- * A reference to the underlying virtual file system.
640
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
636
641
  */
637
- [__VFS_VIRTUAL__]: Volume;
638
- /**
639
- * A reference to the underlying unified file system.
640
- */
641
- [__VFS_UNIFIED__]: IUnionFs;
642
+ dispose: () => Promise<void>;
642
643
  }
643
644
 
644
645
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -810,6 +811,13 @@ interface BaseConfig {
810
811
  * This configuration will be used by the documentation generation plugins during the `docs` command.
811
812
  */
812
813
  docs?: Record<string, any>;
814
+ /**
815
+ * Configuration for deploying the source code
816
+ *
817
+ * @remarks
818
+ * If set to `false`, the deployment will be disabled.
819
+ */
820
+ deploy?: Record<string, any> | false;
813
821
  /**
814
822
  * The path to the tsconfig file to be used by the compiler
815
823
  *
@@ -923,7 +931,7 @@ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedCo
923
931
  override?: Partial<TBuildResolvedConfig>;
924
932
  };
925
933
  };
926
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
934
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
927
935
  /**
928
936
  * The configuration provided while executing Powerlines commands.
929
937
  */
@@ -962,7 +970,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
962
970
  /**
963
971
  * The resolved options for the Powerlines project configuration.
964
972
  */
965
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "framework">> & {
973
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
966
974
  /**
967
975
  * The configuration options that were provided inline to the Powerlines CLI.
968
976
  */
@@ -1033,14 +1041,6 @@ interface MetaInfo {
1033
1041
  * A hash that represents the path to the project root directory
1034
1042
  */
1035
1043
  configHash: string;
1036
- /**
1037
- * A mapping of runtime ids to their corresponding file paths
1038
- */
1039
- builtinIdMap: Record<string, string>;
1040
- /**
1041
- * A mapping of virtual file paths to their corresponding file contents
1042
- */
1043
- virtualFiles: Record<string, string | null>;
1044
1044
  }
1045
1045
  interface Resolver extends Jiti {
1046
1046
  plugin: Jiti;
@@ -1248,7 +1248,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1248
1248
  }
1249
1249
  type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1250
1250
 
1251
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
1251
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1252
1252
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1253
1253
 
1254
1254
  interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
@@ -17,9 +17,7 @@ import { Range } from 'semver';
17
17
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
18
18
  import ts from 'typescript';
19
19
  import { PrimitiveJsonValue } from '@stryke/json/types';
20
- import { Volume } from 'memfs';
21
20
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
22
- import { IUnionFs } from 'unionfs';
23
21
 
24
22
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
25
23
  interface BuildConfig {
@@ -29,6 +27,20 @@ interface BuildConfig {
29
27
  * @defaultValue "neutral"
30
28
  */
31
29
  platform?: "node" | "browser" | "neutral";
30
+ /**
31
+ * Array of strings indicating the polyfills to include for the build.
32
+ *
33
+ * @remarks
34
+ * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * {
39
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
40
+ * }
41
+ * ```
42
+ */
43
+ polyfill?: string[];
32
44
  /**
33
45
  * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
34
46
  *
@@ -114,7 +126,10 @@ interface BuildConfig {
114
126
  *
115
127
  * @see https://github.com/rollup/plugins/tree/master/packages/alias
116
128
  */
117
- alias?: Record<string, string>;
129
+ alias?: Record<string, string> | Array<{
130
+ find: string | RegExp;
131
+ replacement: string;
132
+ }>;
118
133
  /**
119
134
  * A list of modules that should not be bundled, even if they are external dependencies.
120
135
  *
@@ -254,11 +269,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
254
269
  tsconfigFilePath: string;
255
270
  };
256
271
 
257
- declare const __VFS_INIT__ = "__VFS_INIT__";
258
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
259
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
260
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
261
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
272
+ declare const __VFS_PATCH__: unique symbol;
273
+ declare const __VFS_REVERT__: unique symbol;
262
274
  type OutputModeType = "fs" | "virtual";
263
275
  interface VirtualFile {
264
276
  /**
@@ -298,7 +310,24 @@ interface VirtualFile {
298
310
  */
299
311
  code: string | NodeJS.ArrayBufferView;
300
312
  }
301
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
313
+ interface VirtualFileMetadata {
314
+ /**
315
+ * The identifier for the file data.
316
+ */
317
+ id: string;
318
+ /**
319
+ * The variant of the file.
320
+ */
321
+ variant: string;
322
+ /**
323
+ * The output mode of the file.
324
+ */
325
+ mode: string;
326
+ /**
327
+ * Additional metadata associated with the file.
328
+ */
329
+ properties: Record<string, string>;
330
+ }
302
331
  interface ResolveFSOptions {
303
332
  mode?: OutputModeType;
304
333
  }
@@ -327,12 +356,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
327
356
  type?: "file" | "directory";
328
357
  }
329
358
  interface VirtualFileSystemInterface {
330
- [__VFS_INIT__]: () => void;
359
+ /**
360
+ * Patches the File System to include the virtual file system (VFS) contents.
361
+ */
362
+ [__VFS_PATCH__]: () => void;
363
+ /**
364
+ * Reverts the virtual file system (VFS) to its previous state.
365
+ */
331
366
  [__VFS_REVERT__]: () => void;
332
367
  /**
333
368
  * The underlying file metadata.
334
369
  */
335
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
370
+ metadata: Record<string, VirtualFileMetadata | undefined>;
336
371
  /**
337
372
  * A map of module ids to their file paths.
338
373
  */
@@ -352,7 +387,7 @@ interface VirtualFileSystemInterface {
352
387
  * @param options - Optional parameters for resolving the path.
353
388
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
354
389
  */
355
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
390
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
356
391
  /**
357
392
  * Checks if a file exists in the virtual file system (VFS).
358
393
  *
@@ -367,15 +402,6 @@ interface VirtualFileSystemInterface {
367
402
  * @returns `true` if the directory exists, otherwise `false`.
368
403
  */
369
404
  isDirectory: (path: string) => boolean;
370
- /**
371
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
372
- *
373
- * @see https://www.typescriptlang.org/tsconfig#paths
374
- *
375
- * @param pathOrId - The path or id to check.
376
- * @returns Whether the path or id corresponds to a virtual file.
377
- */
378
- isTsconfigPath: (pathOrId: string) => boolean;
379
405
  /**
380
406
  * Checks if a file exists in the virtual file system (VFS).
381
407
  *
@@ -389,7 +415,7 @@ interface VirtualFileSystemInterface {
389
415
  * @param pathOrId - The path or id of the file.
390
416
  * @returns The metadata of the file if it exists, otherwise undefined.
391
417
  */
392
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
418
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
393
419
  /**
394
420
  * Gets the stats of a file in the virtual file system (VFS).
395
421
  *
@@ -597,23 +623,12 @@ interface VirtualFileSystemInterface {
597
623
  */
598
624
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
599
625
  /**
600
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
601
- *
602
- * @see https://www.typescriptlang.org/tsconfig#paths
626
+ * Formats a path to match the virtual file system (VFS) structure.
603
627
  *
604
- * @param path - The path to check.
605
- * @returns The resolved file path if it exists, otherwise undefined.
628
+ * @param path - The path to format.
629
+ * @returns The formatted path.
606
630
  */
607
- resolveTsconfigPath: (path: string) => string | false;
608
- /**
609
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
610
- *
611
- * @see https://www.typescriptlang.org/tsconfig#paths
612
- *
613
- * @param path - The path to check.
614
- * @returns The resolved package name if it exists, otherwise undefined.
615
- */
616
- resolveTsconfigPathPackage: (path: string) => string | false;
631
+ formatPath: (path: string) => string;
617
632
  /**
618
633
  * Resolves a path or id to a file path in the virtual file system.
619
634
  *
@@ -622,23 +637,9 @@ interface VirtualFileSystemInterface {
622
637
  */
623
638
  realpathSync: (pathOrId: string) => string;
624
639
  /**
625
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
626
- *
627
- * @returns A record mapping file paths to their partial metadata.
628
- */
629
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
630
- /**
631
- * A map of cached file paths to their underlying file content.
632
- */
633
- [__VFS_CACHE__]: Map<string, string>;
634
- /**
635
- * A reference to the underlying virtual file system.
640
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
636
641
  */
637
- [__VFS_VIRTUAL__]: Volume;
638
- /**
639
- * A reference to the underlying unified file system.
640
- */
641
- [__VFS_UNIFIED__]: IUnionFs;
642
+ dispose: () => Promise<void>;
642
643
  }
643
644
 
644
645
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -810,6 +811,13 @@ interface BaseConfig {
810
811
  * This configuration will be used by the documentation generation plugins during the `docs` command.
811
812
  */
812
813
  docs?: Record<string, any>;
814
+ /**
815
+ * Configuration for deploying the source code
816
+ *
817
+ * @remarks
818
+ * If set to `false`, the deployment will be disabled.
819
+ */
820
+ deploy?: Record<string, any> | false;
813
821
  /**
814
822
  * The path to the tsconfig file to be used by the compiler
815
823
  *
@@ -923,7 +931,7 @@ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedCo
923
931
  override?: Partial<TBuildResolvedConfig>;
924
932
  };
925
933
  };
926
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
934
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
927
935
  /**
928
936
  * The configuration provided while executing Powerlines commands.
929
937
  */
@@ -962,7 +970,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
962
970
  /**
963
971
  * The resolved options for the Powerlines project configuration.
964
972
  */
965
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "framework">> & {
973
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
966
974
  /**
967
975
  * The configuration options that were provided inline to the Powerlines CLI.
968
976
  */
@@ -1033,14 +1041,6 @@ interface MetaInfo {
1033
1041
  * A hash that represents the path to the project root directory
1034
1042
  */
1035
1043
  configHash: string;
1036
- /**
1037
- * A mapping of runtime ids to their corresponding file paths
1038
- */
1039
- builtinIdMap: Record<string, string>;
1040
- /**
1041
- * A mapping of virtual file paths to their corresponding file contents
1042
- */
1043
- virtualFiles: Record<string, string | null>;
1044
1044
  }
1045
1045
  interface Resolver extends Jiti {
1046
1046
  plugin: Jiti;
@@ -1248,7 +1248,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1248
1248
  }
1249
1249
  type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1250
1250
 
1251
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
1251
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1252
1252
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1253
1253
 
1254
1254
  interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
@@ -1,5 +1,5 @@
1
1
  export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from './plugin.cjs';
2
- import '../plugin-DNQSUN-t.cjs';
2
+ import '../plugin-CwYWLG3U.cjs';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -19,6 +19,4 @@ import 'semver';
19
19
  import '@stryke/types/tsconfig';
20
20
  import 'typescript';
21
21
  import '@stryke/json/types';
22
- import 'memfs';
23
22
  import 'node:fs';
24
- import 'unionfs';
@@ -1,5 +1,5 @@
1
1
  export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from './plugin.js';
2
- import '../plugin-DNQSUN-t.js';
2
+ import '../plugin-CwYWLG3U.js';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -19,6 +19,4 @@ import 'semver';
19
19
  import '@stryke/types/tsconfig';
20
20
  import 'typescript';
21
21
  import '@stryke/json/types';
22
- import 'memfs';
23
22
  import 'node:fs';
24
- import 'unionfs';
@@ -1,4 +1,4 @@
1
- import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-DNQSUN-t.cjs';
1
+ import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-CwYWLG3U.cjs';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  type BabelPluginOptions = Partial<BabelUserConfig>;
26
24
  type BabelPluginUserConfig = UserConfig;
@@ -1,4 +1,4 @@
1
- import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-DNQSUN-t.js';
1
+ import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-CwYWLG3U.js';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -18,9 +18,7 @@ import 'semver';
18
18
  import '@stryke/types/tsconfig';
19
19
  import 'typescript';
20
20
  import '@stryke/json/types';
21
- import 'memfs';
22
21
  import 'node:fs';
23
- import 'unionfs';
24
22
 
25
23
  type BabelPluginOptions = Partial<BabelUserConfig>;
26
24
  type BabelPluginUserConfig = UserConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-babel",
3
- "version": "0.12.19",
3
+ "version": "0.12.21",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -144,15 +144,15 @@
144
144
  "chalk": "5.6.2",
145
145
  "defu": "^6.1.4",
146
146
  "jiti": "^2.6.1",
147
- "powerlines": "^0.20.0",
147
+ "powerlines": "^0.22.0",
148
148
  "unplugin": "^2.3.10"
149
149
  },
150
150
  "devDependencies": {
151
151
  "@babel/plugin-syntax-typescript": "^7.27.1",
152
- "@powerlines/nx": "^0.10.10",
153
- "@powerlines/plugin-plugin": "^0.11.18",
152
+ "@powerlines/nx": "^0.10.12",
153
+ "@powerlines/plugin-plugin": "^0.11.20",
154
154
  "@types/node": "^22.19.1"
155
155
  },
156
156
  "publishConfig": { "access": "public" },
157
- "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
157
+ "gitHead": "30a4cf4f1c707fe159b55f65f1e87b14d679614d"
158
158
  }