@visulima/packem 1.0.0-alpha.1 → 1.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +3 -0
  3. package/dist/cli.cjs +1 -1
  4. package/dist/cli.mjs +1 -1
  5. package/dist/config.cjs +1 -1
  6. package/dist/config.d.cts +6 -2
  7. package/dist/config.d.mts +6 -2
  8. package/dist/config.d.ts +6 -2
  9. package/dist/create-bundler.cjs +52 -51
  10. package/dist/create-bundler.d.cts +6 -3
  11. package/dist/create-bundler.d.mts +6 -3
  12. package/dist/create-bundler.d.ts +6 -3
  13. package/dist/create-bundler.mjs +54 -53
  14. package/dist/rollup/plugins/esbuild/index.cjs +1 -0
  15. package/dist/rollup/plugins/esbuild/index.d.cts +9 -0
  16. package/dist/rollup/plugins/esbuild/index.d.mts +9 -0
  17. package/dist/rollup/plugins/esbuild/index.d.ts +9 -0
  18. package/dist/rollup/plugins/esbuild/index.mjs +9 -0
  19. package/dist/rollup/plugins/sucrase/index.cjs +1 -0
  20. package/dist/rollup/plugins/sucrase/index.d.cts +8 -0
  21. package/dist/rollup/plugins/sucrase/index.d.mts +8 -0
  22. package/dist/rollup/plugins/sucrase/index.d.ts +8 -0
  23. package/dist/rollup/plugins/sucrase/index.mjs +1 -0
  24. package/dist/rollup/plugins/swc/index.cjs +1 -0
  25. package/dist/rollup/plugins/swc/index.d.cts +7 -0
  26. package/dist/rollup/plugins/swc/index.d.mts +7 -0
  27. package/dist/rollup/plugins/swc/index.d.ts +7 -0
  28. package/dist/rollup/plugins/swc/index.mjs +1 -0
  29. package/dist/shared/packem.Bdmp1hC5.mjs +1 -0
  30. package/dist/shared/packem.Bj4QPFg7.mjs +1 -0
  31. package/dist/shared/{packem.gPxnaycf.d.cts → packem.C44tLE3n.d.cts} +3 -196
  32. package/dist/shared/{packem.gPxnaycf.d.mts → packem.C44tLE3n.d.mts} +3 -196
  33. package/dist/shared/{packem.gPxnaycf.d.ts → packem.C44tLE3n.d.ts} +3 -196
  34. package/dist/shared/packem.CAQMZ6ex.d.mts +176 -0
  35. package/dist/shared/packem.CEXB7aOL.cjs +1 -0
  36. package/dist/shared/packem.D09xRBAa.d.cts +25 -0
  37. package/dist/shared/packem.D09xRBAa.d.mts +25 -0
  38. package/dist/shared/packem.D09xRBAa.d.ts +25 -0
  39. package/dist/shared/packem.DZfoF9Bk.d.cts +176 -0
  40. package/dist/shared/packem.DvWhOdt5.d.cts +10 -0
  41. package/dist/shared/packem.DvWhOdt5.d.mts +10 -0
  42. package/dist/shared/packem.DvWhOdt5.d.ts +10 -0
  43. package/dist/shared/packem.aHRI8QbF.d.ts +176 -0
  44. package/dist/shared/packem.uvB0cQX0.cjs +1 -0
  45. package/package.json +35 -3
@@ -1,77 +1,4 @@
1
- import { RollupAliasOptions } from '@rollup/plugin-alias';
2
- import { RollupCommonJSOptions } from '@rollup/plugin-commonjs';
3
- import { RollupJsonOptions } from '@rollup/plugin-json';
4
- import { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';
5
- import { RollupReplaceOptions } from '@rollup/plugin-replace';
6
- import { RollupWasmOptions } from '@rollup/plugin-wasm';
7
1
  import { FilterPattern } from '@rollup/pluginutils';
8
- import { PackageJson, TsConfigResult } from '@visulima/package';
9
- import { Pail } from '@visulima/pail';
10
- import { Hookable } from 'hookable';
11
- import { JITIOptions } from 'jiti';
12
- import { RollupBuild, RollupOptions, RollupWatcher, OutputOptions } from 'rollup';
13
- import { Options as Options$3 } from 'rollup-plugin-dts';
14
- import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
15
- import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
16
- import { TransformOptions, Loader, BuildOptions as BuildOptions$1 } from 'esbuild';
17
- import { Options as Options$2 } from 'sucrase';
18
-
19
- interface CJSInteropOptions {
20
- addDefaultProperty?: boolean;
21
- }
22
-
23
- type SingleTargetDesc = {
24
- dest?: string;
25
- exclude?: string[] | string;
26
- src: string[] | string;
27
- };
28
- type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
29
- type CopyPluginOptions = {
30
- copyOnce?: boolean;
31
- exactFileNames?: boolean;
32
- flatten?: boolean;
33
- targets: MultipleTargetsDesc;
34
- };
35
-
36
- type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
37
-
38
- type Options$1 = Omit<TransformOptions, "loader" | "sourcemap"> & {
39
- exclude?: FilterPattern;
40
- include?: FilterPattern;
41
- loaders?: Record<string, Loader | false>;
42
- optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
43
- sourceMap?: boolean;
44
- };
45
- type OptimizeDepsOptions = {
46
- cwd: string;
47
- esbuildOptions?: BuildOptions$1;
48
- exclude?: string[];
49
- include: string[];
50
- sourceMap: boolean;
51
- };
52
-
53
- type JSXRemoveAttributesPlugin = {
54
- attributes: string[];
55
- };
56
-
57
- interface LicenseOptions {
58
- dtsMarker?: string;
59
- dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
60
- marker?: string;
61
- path?: string;
62
- template?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
63
- }
64
-
65
- interface RawLoaderOptions {
66
- exclude?: FilterPattern;
67
- include?: FilterPattern;
68
- }
69
-
70
- interface SucrasePluginConfig extends Options$2 {
71
- exclude?: FilterPattern;
72
- extensions?: string[];
73
- include?: FilterPattern;
74
- }
75
2
 
76
3
  interface Plugin {
77
4
  (module: Program): Program;
@@ -1983,130 +1910,10 @@ interface Invalid extends Node, HasSpan {
1983
1910
  type: "Invalid";
1984
1911
  }
1985
1912
 
1986
- type SwcPluginConfig = Exclude<Options, "configFile" | "exclude" | "filename" | "sourceMaps" | "swcrc"> & {
1913
+ type SwcPluginConfig = {
1987
1914
  exclude?: FilterPattern;
1988
1915
  extensions?: string[];
1989
1916
  include?: FilterPattern;
1990
- };
1991
-
1992
- interface PatchTypesOptions {
1993
- identifierReplacements?: Record<string, Record<string, string>>;
1994
- }
1995
-
1996
- type DeepPartial<T> = {
1997
- [P in keyof T]?: DeepPartial<T[P]>;
1998
- };
1999
- interface RollupDynamicImportVariablesOptions {
2000
- errorWhenNoFilesFound?: boolean;
2001
- exclude?: FilterPattern;
2002
- include?: FilterPattern;
2003
- warnOnError?: boolean;
2004
- }
2005
- interface RollupBuildOptions {
2006
- alias: RollupAliasOptions | false;
2007
- cjsInterop?: CJSInteropOptions;
2008
- commonjs: RollupCommonJSOptions | false;
2009
- copy?: CopyPluginOptions | false;
2010
- dts: Options$3;
2011
- dynamicVars?: RollupDynamicImportVariablesOptions | false;
2012
- emitCJS?: boolean;
2013
- emitESM?: boolean;
2014
- esbuild: Options$1 | false;
2015
- json: RollupJsonOptions | false;
2016
- jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
2017
- license?: LicenseOptions | false;
2018
- metafile?: boolean;
2019
- output?: OutputOptions;
2020
- patchTypes: PatchTypesOptions | false;
2021
- polyfillNode?: NodePolyfillsOptions | false;
2022
- preserveDynamicImports?: boolean;
2023
- raw?: RawLoaderOptions | false;
2024
- replace: RollupReplaceOptions | false;
2025
- resolve: RollupNodeResolveOptions | false;
2026
- shim?: boolean;
2027
- sucrase?: SucrasePluginConfig | false;
2028
- swc?: SwcPluginConfig | false;
2029
- treeshake?: RollupOptions["treeshake"];
2030
- visualizer?: PluginVisualizerOptions | false;
2031
- watch?: RollupOptions["watch"];
2032
- wsam?: RollupWasmOptions | false;
2033
- }
2034
- type BuildEntry = {
2035
- declaration?: boolean | "compatible" | "node16";
2036
- format?: string;
2037
- input: string;
2038
- isExecutable?: boolean;
2039
- name?: string;
2040
- outDir?: string;
2041
- };
2042
- interface BuildOptions {
2043
- alias: Record<string, string>;
2044
- cjsInterop?: boolean;
2045
- clean: boolean;
2046
- declaration?: boolean | "compatible" | "node16";
2047
- dependencies: string[];
2048
- devDependencies: string[];
2049
- entries: BuildEntry[];
2050
- externals: (RegExp | string)[];
2051
- failOnWarn?: boolean;
2052
- name: string;
2053
- optionalDependencies: string[];
2054
- outDir: string;
2055
- peerDependencies: string[];
2056
- replace: Record<string, string>;
2057
- rollup: RollupBuildOptions;
2058
- rootDir: string;
2059
- sourcemap: boolean;
2060
- stub: boolean;
2061
- stubOptions: {
2062
- jiti: Omit<JITIOptions, "onError" | "transform">;
2063
- };
2064
- target: string;
2065
- transformer: "esbuild" | "sucrase" | "swc";
2066
- }
2067
- interface BuildHooks {
2068
- "build:before": (context: BuildContext) => Promise<void> | void;
2069
- "build:done": (context: BuildContext) => Promise<void> | void;
2070
- "build:prepare": (context: BuildContext) => Promise<void> | void;
2071
- "rollup:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
2072
- "rollup:done": (context: BuildContext) => Promise<void> | void;
2073
- "rollup:dts:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
2074
- "rollup:dts:done": (context: BuildContext) => Promise<void> | void;
2075
- "rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
2076
- "rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
2077
- "rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
2078
- }
2079
- type BuildContextBuildEntry = {
2080
- bytes?: number;
2081
- chunk?: boolean;
2082
- chunks?: string[];
2083
- exports?: string[];
2084
- modules?: {
2085
- bytes: number;
2086
- id: string;
2087
- }[];
2088
- path: string;
2089
- type?: "asset" | "chunk" | "entry";
2090
- };
2091
- interface BuildContext {
2092
- buildEntries: BuildContextBuildEntry[];
2093
- dependencyGraphMap: Map<string, Set<[string, string]>>;
2094
- hooks: Hookable<BuildHooks>;
2095
- logger: Pail<never, string>;
2096
- mode: Mode;
2097
- options: BuildOptions;
2098
- pkg: PackageJson;
2099
- rootDir: string;
2100
- tsconfig?: TsConfigResult;
2101
- usedImports: Set<string>;
2102
- warnings: Set<string>;
2103
- }
2104
- type BuildPreset = BuildConfig | (() => BuildConfig);
2105
- interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
2106
- entries?: (BuildEntry | string)[];
2107
- hooks?: Partial<BuildHooks>;
2108
- preset?: BuildPreset | string;
2109
- }
2110
- type Mode = "build" | "jit" | "watch";
1917
+ } & Exclude<Options, "configFile" | "exclude" | "filename" | "sourceMaps" | "swcrc">;
2111
1918
 
2112
- export type { BuildConfig as B, Mode as M, BuildPreset as a };
1919
+ export type { SwcPluginConfig as S };
@@ -0,0 +1,176 @@
1
+ import { RollupAliasOptions } from '@rollup/plugin-alias';
2
+ import { RollupCommonJSOptions } from '@rollup/plugin-commonjs';
3
+ import { RollupJsonOptions } from '@rollup/plugin-json';
4
+ import { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';
5
+ import { RollupReplaceOptions } from '@rollup/plugin-replace';
6
+ import { RollupWasmOptions } from '@rollup/plugin-wasm';
7
+ import { FilterPattern } from '@rollup/pluginutils';
8
+ import { PackageJson, TsConfigResult } from '@visulima/package';
9
+ import { Pail } from '@visulima/pail';
10
+ import { Hookable } from 'hookable';
11
+ import { JITIOptions } from 'jiti';
12
+ import { RollupBuild, RollupOptions, RollupWatcher, Plugin, OutputOptions } from 'rollup';
13
+ import { Options } from 'rollup-plugin-dts';
14
+ import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
15
+ import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
16
+ import { E as EsbuildPluginConfig, O as Options$1 } from './packem.D09xRBAa.mjs';
17
+ import { S as SucrasePluginConfig } from './packem.DvWhOdt5.mjs';
18
+ import { S as SwcPluginConfig } from './packem.C44tLE3n.mjs';
19
+
20
+ interface CJSInteropOptions {
21
+ addDefaultProperty?: boolean;
22
+ }
23
+
24
+ type SingleTargetDesc = {
25
+ dest?: string;
26
+ exclude?: string[] | string;
27
+ src: string[] | string;
28
+ };
29
+ type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
30
+ type CopyPluginOptions = {
31
+ copyOnce?: boolean;
32
+ exactFileNames?: boolean;
33
+ flatten?: boolean;
34
+ targets: MultipleTargetsDesc;
35
+ };
36
+
37
+ type JSXRemoveAttributesPlugin = {
38
+ attributes: string[];
39
+ };
40
+
41
+ interface LicenseOptions {
42
+ dtsMarker?: string;
43
+ dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
44
+ marker?: string;
45
+ path?: string;
46
+ template?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
47
+ }
48
+
49
+ interface RawLoaderOptions {
50
+ exclude?: FilterPattern;
51
+ include?: FilterPattern;
52
+ }
53
+
54
+ interface PatchTypesOptions {
55
+ identifierReplacements?: Record<string, Record<string, string>>;
56
+ }
57
+
58
+ type DeepPartial<T> = {
59
+ [P in keyof T]?: DeepPartial<T[P]>;
60
+ };
61
+ interface RollupDynamicImportVariablesOptions {
62
+ errorWhenNoFilesFound?: boolean;
63
+ exclude?: FilterPattern;
64
+ include?: FilterPattern;
65
+ warnOnError?: boolean;
66
+ }
67
+ interface RollupBuildOptions {
68
+ alias: RollupAliasOptions | false;
69
+ cjsInterop?: CJSInteropOptions;
70
+ commonjs: RollupCommonJSOptions | false;
71
+ copy?: CopyPluginOptions | false;
72
+ dts: Options;
73
+ dynamicVars?: RollupDynamicImportVariablesOptions | false;
74
+ esbuild: Options$1 | false;
75
+ json: RollupJsonOptions | false;
76
+ jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
77
+ license?: LicenseOptions | false;
78
+ metafile?: boolean;
79
+ output?: OutputOptions;
80
+ patchTypes: PatchTypesOptions | false;
81
+ polyfillNode?: NodePolyfillsOptions | false;
82
+ preserveDynamicImports?: boolean;
83
+ raw?: RawLoaderOptions | false;
84
+ replace: RollupReplaceOptions | false;
85
+ resolve: RollupNodeResolveOptions | false;
86
+ shim?: boolean;
87
+ sucrase?: SucrasePluginConfig | false;
88
+ swc?: SwcPluginConfig | false;
89
+ treeshake?: RollupOptions["treeshake"];
90
+ visualizer?: PluginVisualizerOptions | false;
91
+ watch?: RollupOptions["watch"];
92
+ wsam?: RollupWasmOptions | false;
93
+ }
94
+ type BuildEntry = {
95
+ declaration?: boolean | "compatible" | "node16";
96
+ input: string;
97
+ isExecutable?: boolean;
98
+ name?: string;
99
+ outDir?: string;
100
+ };
101
+ interface BuildOptions {
102
+ alias: Record<string, string>;
103
+ cjsInterop?: boolean;
104
+ clean: boolean;
105
+ declaration?: boolean | "compatible" | "node16";
106
+ dependencies: string[];
107
+ devDependencies: string[];
108
+ emitCJS?: boolean;
109
+ emitESM?: boolean;
110
+ entries: BuildEntry[];
111
+ externals: (RegExp | string)[];
112
+ failOnWarn?: boolean;
113
+ minify: boolean;
114
+ name: string;
115
+ optionalDependencies: string[];
116
+ outDir: string;
117
+ peerDependencies: string[];
118
+ replace: Record<string, string>;
119
+ rollup: RollupBuildOptions;
120
+ rootDir: string;
121
+ sourcemap: boolean;
122
+ stub: boolean;
123
+ stubOptions: {
124
+ jiti: Omit<JITIOptions, "onError" | "transform">;
125
+ };
126
+ transformer?: (config: SwcPluginConfig | SucrasePluginConfig | EsbuildPluginConfig) => Plugin;
127
+ }
128
+ interface BuildHooks {
129
+ "build:before": (context: BuildContext) => Promise<void> | void;
130
+ "build:done": (context: BuildContext) => Promise<void> | void;
131
+ "build:prepare": (context: BuildContext) => Promise<void> | void;
132
+ "rollup:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
133
+ "rollup:done": (context: BuildContext) => Promise<void> | void;
134
+ "rollup:dts:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
135
+ "rollup:dts:done": (context: BuildContext) => Promise<void> | void;
136
+ "rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
137
+ "rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
138
+ "rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
139
+ }
140
+ type BuildContextBuildEntry = {
141
+ bytes?: number;
142
+ chunk?: boolean;
143
+ chunks?: string[];
144
+ exports?: string[];
145
+ modules?: {
146
+ bytes: number;
147
+ id: string;
148
+ }[];
149
+ path: string;
150
+ type?: "asset" | "chunk" | "entry";
151
+ };
152
+ interface InternalBuildOptions extends BuildOptions {
153
+ transformerName: "esbuild" | "sucrase" | "swc" | undefined;
154
+ }
155
+ interface BuildContext {
156
+ buildEntries: BuildContextBuildEntry[];
157
+ dependencyGraphMap: Map<string, Set<[string, string]>>;
158
+ hooks: Hookable<BuildHooks>;
159
+ logger: Pail<never, string>;
160
+ mode: Mode;
161
+ options: InternalBuildOptions;
162
+ pkg: PackageJson;
163
+ rootDir: string;
164
+ tsconfig?: TsConfigResult;
165
+ usedImports: Set<string>;
166
+ warnings: Set<string>;
167
+ }
168
+ type BuildPreset = BuildConfig | (() => BuildConfig);
169
+ interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
170
+ entries?: (BuildEntry | string)[];
171
+ hooks?: Partial<BuildHooks>;
172
+ preset?: BuildPreset | string;
173
+ }
174
+ type Mode = "build" | "jit" | "watch";
175
+
176
+ export type { BuildConfig as B, Mode as M, BuildPreset as a, BuildHooks as b };
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var s=(r,e)=>i(r,"name",{value:e,configurable:!0});const u=require("node:fs"),a=require("@visulima/path");var f=Object.defineProperty,l=s((r,e)=>f(r,"name",{value:e,configurable:!0}),"o");const x=l((r,e,t=!1)=>{const c=e.replace(/\.[jt]sx?$/,"");for(const n of r){const o=t?a.join(e,`index${n}`):`${c}${n}`;if(u.existsSync(o))return o}return null},"resolveFile");exports.x=x;
@@ -0,0 +1,25 @@
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Pail } from '@visulima/pail';
3
+ import { Loader, TransformOptions, BuildOptions } from 'esbuild';
4
+
5
+ type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
6
+
7
+ type Options = {
8
+ exclude?: FilterPattern;
9
+ include?: FilterPattern;
10
+ loaders?: Record<string, Loader | false>;
11
+ optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
12
+ sourceMap?: boolean;
13
+ } & Omit<TransformOptions, "loader" | "sourcemap">;
14
+ type OptimizeDepsOptions = {
15
+ cwd: string;
16
+ esbuildOptions?: BuildOptions;
17
+ exclude?: string[];
18
+ include: string[];
19
+ sourceMap: boolean;
20
+ };
21
+ type EsbuildPluginConfig = {
22
+ logger: Pail<never, string>;
23
+ } & Options;
24
+
25
+ export type { EsbuildPluginConfig as E, Options as O };
@@ -0,0 +1,25 @@
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Pail } from '@visulima/pail';
3
+ import { Loader, TransformOptions, BuildOptions } from 'esbuild';
4
+
5
+ type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
6
+
7
+ type Options = {
8
+ exclude?: FilterPattern;
9
+ include?: FilterPattern;
10
+ loaders?: Record<string, Loader | false>;
11
+ optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
12
+ sourceMap?: boolean;
13
+ } & Omit<TransformOptions, "loader" | "sourcemap">;
14
+ type OptimizeDepsOptions = {
15
+ cwd: string;
16
+ esbuildOptions?: BuildOptions;
17
+ exclude?: string[];
18
+ include: string[];
19
+ sourceMap: boolean;
20
+ };
21
+ type EsbuildPluginConfig = {
22
+ logger: Pail<never, string>;
23
+ } & Options;
24
+
25
+ export type { EsbuildPluginConfig as E, Options as O };
@@ -0,0 +1,25 @@
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Pail } from '@visulima/pail';
3
+ import { Loader, TransformOptions, BuildOptions } from 'esbuild';
4
+
5
+ type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
6
+
7
+ type Options = {
8
+ exclude?: FilterPattern;
9
+ include?: FilterPattern;
10
+ loaders?: Record<string, Loader | false>;
11
+ optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
12
+ sourceMap?: boolean;
13
+ } & Omit<TransformOptions, "loader" | "sourcemap">;
14
+ type OptimizeDepsOptions = {
15
+ cwd: string;
16
+ esbuildOptions?: BuildOptions;
17
+ exclude?: string[];
18
+ include: string[];
19
+ sourceMap: boolean;
20
+ };
21
+ type EsbuildPluginConfig = {
22
+ logger: Pail<never, string>;
23
+ } & Options;
24
+
25
+ export type { EsbuildPluginConfig as E, Options as O };
@@ -0,0 +1,176 @@
1
+ import { RollupAliasOptions } from '@rollup/plugin-alias';
2
+ import { RollupCommonJSOptions } from '@rollup/plugin-commonjs';
3
+ import { RollupJsonOptions } from '@rollup/plugin-json';
4
+ import { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';
5
+ import { RollupReplaceOptions } from '@rollup/plugin-replace';
6
+ import { RollupWasmOptions } from '@rollup/plugin-wasm';
7
+ import { FilterPattern } from '@rollup/pluginutils';
8
+ import { PackageJson, TsConfigResult } from '@visulima/package';
9
+ import { Pail } from '@visulima/pail';
10
+ import { Hookable } from 'hookable';
11
+ import { JITIOptions } from 'jiti';
12
+ import { RollupBuild, RollupOptions, RollupWatcher, Plugin, OutputOptions } from 'rollup';
13
+ import { Options } from 'rollup-plugin-dts';
14
+ import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
15
+ import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
16
+ import { E as EsbuildPluginConfig, O as Options$1 } from './packem.D09xRBAa.cjs';
17
+ import { S as SucrasePluginConfig } from './packem.DvWhOdt5.cjs';
18
+ import { S as SwcPluginConfig } from './packem.C44tLE3n.cjs';
19
+
20
+ interface CJSInteropOptions {
21
+ addDefaultProperty?: boolean;
22
+ }
23
+
24
+ type SingleTargetDesc = {
25
+ dest?: string;
26
+ exclude?: string[] | string;
27
+ src: string[] | string;
28
+ };
29
+ type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
30
+ type CopyPluginOptions = {
31
+ copyOnce?: boolean;
32
+ exactFileNames?: boolean;
33
+ flatten?: boolean;
34
+ targets: MultipleTargetsDesc;
35
+ };
36
+
37
+ type JSXRemoveAttributesPlugin = {
38
+ attributes: string[];
39
+ };
40
+
41
+ interface LicenseOptions {
42
+ dtsMarker?: string;
43
+ dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
44
+ marker?: string;
45
+ path?: string;
46
+ template?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
47
+ }
48
+
49
+ interface RawLoaderOptions {
50
+ exclude?: FilterPattern;
51
+ include?: FilterPattern;
52
+ }
53
+
54
+ interface PatchTypesOptions {
55
+ identifierReplacements?: Record<string, Record<string, string>>;
56
+ }
57
+
58
+ type DeepPartial<T> = {
59
+ [P in keyof T]?: DeepPartial<T[P]>;
60
+ };
61
+ interface RollupDynamicImportVariablesOptions {
62
+ errorWhenNoFilesFound?: boolean;
63
+ exclude?: FilterPattern;
64
+ include?: FilterPattern;
65
+ warnOnError?: boolean;
66
+ }
67
+ interface RollupBuildOptions {
68
+ alias: RollupAliasOptions | false;
69
+ cjsInterop?: CJSInteropOptions;
70
+ commonjs: RollupCommonJSOptions | false;
71
+ copy?: CopyPluginOptions | false;
72
+ dts: Options;
73
+ dynamicVars?: RollupDynamicImportVariablesOptions | false;
74
+ esbuild: Options$1 | false;
75
+ json: RollupJsonOptions | false;
76
+ jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
77
+ license?: LicenseOptions | false;
78
+ metafile?: boolean;
79
+ output?: OutputOptions;
80
+ patchTypes: PatchTypesOptions | false;
81
+ polyfillNode?: NodePolyfillsOptions | false;
82
+ preserveDynamicImports?: boolean;
83
+ raw?: RawLoaderOptions | false;
84
+ replace: RollupReplaceOptions | false;
85
+ resolve: RollupNodeResolveOptions | false;
86
+ shim?: boolean;
87
+ sucrase?: SucrasePluginConfig | false;
88
+ swc?: SwcPluginConfig | false;
89
+ treeshake?: RollupOptions["treeshake"];
90
+ visualizer?: PluginVisualizerOptions | false;
91
+ watch?: RollupOptions["watch"];
92
+ wsam?: RollupWasmOptions | false;
93
+ }
94
+ type BuildEntry = {
95
+ declaration?: boolean | "compatible" | "node16";
96
+ input: string;
97
+ isExecutable?: boolean;
98
+ name?: string;
99
+ outDir?: string;
100
+ };
101
+ interface BuildOptions {
102
+ alias: Record<string, string>;
103
+ cjsInterop?: boolean;
104
+ clean: boolean;
105
+ declaration?: boolean | "compatible" | "node16";
106
+ dependencies: string[];
107
+ devDependencies: string[];
108
+ emitCJS?: boolean;
109
+ emitESM?: boolean;
110
+ entries: BuildEntry[];
111
+ externals: (RegExp | string)[];
112
+ failOnWarn?: boolean;
113
+ minify: boolean;
114
+ name: string;
115
+ optionalDependencies: string[];
116
+ outDir: string;
117
+ peerDependencies: string[];
118
+ replace: Record<string, string>;
119
+ rollup: RollupBuildOptions;
120
+ rootDir: string;
121
+ sourcemap: boolean;
122
+ stub: boolean;
123
+ stubOptions: {
124
+ jiti: Omit<JITIOptions, "onError" | "transform">;
125
+ };
126
+ transformer?: (config: SwcPluginConfig | SucrasePluginConfig | EsbuildPluginConfig) => Plugin;
127
+ }
128
+ interface BuildHooks {
129
+ "build:before": (context: BuildContext) => Promise<void> | void;
130
+ "build:done": (context: BuildContext) => Promise<void> | void;
131
+ "build:prepare": (context: BuildContext) => Promise<void> | void;
132
+ "rollup:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
133
+ "rollup:done": (context: BuildContext) => Promise<void> | void;
134
+ "rollup:dts:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
135
+ "rollup:dts:done": (context: BuildContext) => Promise<void> | void;
136
+ "rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
137
+ "rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
138
+ "rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
139
+ }
140
+ type BuildContextBuildEntry = {
141
+ bytes?: number;
142
+ chunk?: boolean;
143
+ chunks?: string[];
144
+ exports?: string[];
145
+ modules?: {
146
+ bytes: number;
147
+ id: string;
148
+ }[];
149
+ path: string;
150
+ type?: "asset" | "chunk" | "entry";
151
+ };
152
+ interface InternalBuildOptions extends BuildOptions {
153
+ transformerName: "esbuild" | "sucrase" | "swc" | undefined;
154
+ }
155
+ interface BuildContext {
156
+ buildEntries: BuildContextBuildEntry[];
157
+ dependencyGraphMap: Map<string, Set<[string, string]>>;
158
+ hooks: Hookable<BuildHooks>;
159
+ logger: Pail<never, string>;
160
+ mode: Mode;
161
+ options: InternalBuildOptions;
162
+ pkg: PackageJson;
163
+ rootDir: string;
164
+ tsconfig?: TsConfigResult;
165
+ usedImports: Set<string>;
166
+ warnings: Set<string>;
167
+ }
168
+ type BuildPreset = BuildConfig | (() => BuildConfig);
169
+ interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
170
+ entries?: (BuildEntry | string)[];
171
+ hooks?: Partial<BuildHooks>;
172
+ preset?: BuildPreset | string;
173
+ }
174
+ type Mode = "build" | "jit" | "watch";
175
+
176
+ export type { BuildConfig as B, Mode as M, BuildPreset as a, BuildHooks as b };
@@ -0,0 +1,10 @@
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Options } from 'sucrase';
3
+
4
+ interface SucrasePluginConfig extends Options {
5
+ exclude?: FilterPattern;
6
+ extensions?: string[];
7
+ include?: FilterPattern;
8
+ }
9
+
10
+ export type { SucrasePluginConfig as S };
@@ -0,0 +1,10 @@
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Options } from 'sucrase';
3
+
4
+ interface SucrasePluginConfig extends Options {
5
+ exclude?: FilterPattern;
6
+ extensions?: string[];
7
+ include?: FilterPattern;
8
+ }
9
+
10
+ export type { SucrasePluginConfig as S };
@@ -0,0 +1,10 @@
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Options } from 'sucrase';
3
+
4
+ interface SucrasePluginConfig extends Options {
5
+ exclude?: FilterPattern;
6
+ extensions?: string[];
7
+ include?: FilterPattern;
8
+ }
9
+
10
+ export type { SucrasePluginConfig as S };