@visulima/packem 1.0.0-alpha.2 → 1.0.0-alpha.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.
- package/CHANGELOG.md +163 -0
- package/README.md +16 -3
- package/dist/cli.cjs +7 -1
- package/dist/cli.mjs +15 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +5 -2
- package/dist/config.d.mts +5 -2
- package/dist/config.d.ts +5 -2
- package/dist/config.mjs +9 -1
- package/dist/create-bundler.cjs +93 -1
- package/dist/create-bundler.d.cts +4 -1
- package/dist/create-bundler.d.mts +4 -1
- package/dist/create-bundler.d.ts +4 -1
- package/dist/create-bundler.mjs +101 -1
- package/dist/rollup/plugins/esbuild/index.cjs +1 -0
- package/dist/rollup/plugins/esbuild/index.d.cts +9 -0
- package/dist/rollup/plugins/esbuild/index.d.mts +9 -0
- package/dist/rollup/plugins/esbuild/index.d.ts +9 -0
- package/dist/rollup/plugins/esbuild/index.mjs +9 -0
- package/dist/rollup/plugins/sucrase/index.cjs +1 -0
- package/dist/rollup/plugins/sucrase/index.d.cts +8 -0
- package/dist/rollup/plugins/sucrase/index.d.mts +8 -0
- package/dist/rollup/plugins/sucrase/index.d.ts +8 -0
- package/dist/rollup/plugins/sucrase/index.mjs +9 -0
- package/dist/rollup/plugins/swc/index.cjs +1 -0
- package/dist/rollup/plugins/swc/index.d.cts +7 -0
- package/dist/rollup/plugins/swc/index.d.mts +7 -0
- package/dist/rollup/plugins/swc/index.d.ts +7 -0
- package/dist/rollup/plugins/swc/index.mjs +9 -0
- package/dist/shared/packem.BAcY88If.mjs +9 -0
- package/dist/shared/packem.BK03IQfP.d.ts +176 -0
- package/dist/shared/packem.BchP_OVQ.d.mts +176 -0
- package/dist/shared/{packem.eS2oNfLM.d.ts → packem.C44tLE3n.d.cts} +1 -193
- package/dist/shared/{packem.eS2oNfLM.d.cts → packem.C44tLE3n.d.mts} +1 -193
- package/dist/shared/{packem.eS2oNfLM.d.mts → packem.C44tLE3n.d.ts} +1 -193
- package/dist/shared/packem.CGAPjagQ.d.cts +176 -0
- package/dist/shared/packem.CKW9adaV.cjs +1 -0
- package/dist/shared/packem.CxExFSHU.mjs +9 -0
- package/dist/shared/packem.D09xRBAa.d.cts +25 -0
- package/dist/shared/packem.D09xRBAa.d.mts +25 -0
- package/dist/shared/packem.D09xRBAa.d.ts +25 -0
- package/dist/shared/packem.DvWhOdt5.d.cts +10 -0
- package/dist/shared/packem.DvWhOdt5.d.mts +10 -0
- package/dist/shared/packem.DvWhOdt5.d.ts +10 -0
- package/package.json +57 -17
- package/dist/chunks/index.cjs +0 -1
- package/dist/chunks/index.mjs +0 -1
- package/dist/chunks/index2.cjs +0 -1
- package/dist/chunks/index2.mjs +0 -9
- package/dist/chunks/sucrase.cjs +0 -1
- package/dist/chunks/sucrase.mjs +0 -1
- package/dist/shared/packem.BF9udlBc.mjs +0 -91
- package/dist/shared/packem.Bdmp1hC5.mjs +0 -1
- package/dist/shared/packem.e4bzQy8N.cjs +0 -91
|
@@ -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 { Loader, TransformOptions, 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 = {
|
|
39
|
-
exclude?: FilterPattern;
|
|
40
|
-
include?: FilterPattern;
|
|
41
|
-
loaders?: Record<string, Loader | false>;
|
|
42
|
-
optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
|
|
43
|
-
sourceMap?: boolean;
|
|
44
|
-
} & Omit<TransformOptions, "loader" | "sourcemap">;
|
|
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;
|
|
@@ -1989,123 +1916,4 @@ type SwcPluginConfig = {
|
|
|
1989
1916
|
include?: FilterPattern;
|
|
1990
1917
|
} & Exclude<Options, "configFile" | "exclude" | "filename" | "sourceMaps" | "swcrc">;
|
|
1991
1918
|
|
|
1992
|
-
|
|
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
|
-
esbuild: Options$1 | false;
|
|
2013
|
-
json: RollupJsonOptions | false;
|
|
2014
|
-
jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
|
|
2015
|
-
license?: LicenseOptions | false;
|
|
2016
|
-
metafile?: boolean;
|
|
2017
|
-
output?: OutputOptions;
|
|
2018
|
-
patchTypes: PatchTypesOptions | false;
|
|
2019
|
-
polyfillNode?: NodePolyfillsOptions | false;
|
|
2020
|
-
preserveDynamicImports?: boolean;
|
|
2021
|
-
raw?: RawLoaderOptions | false;
|
|
2022
|
-
replace: RollupReplaceOptions | false;
|
|
2023
|
-
resolve: RollupNodeResolveOptions | false;
|
|
2024
|
-
shim?: boolean;
|
|
2025
|
-
sucrase?: SucrasePluginConfig | false;
|
|
2026
|
-
swc?: SwcPluginConfig | false;
|
|
2027
|
-
treeshake?: RollupOptions["treeshake"];
|
|
2028
|
-
visualizer?: PluginVisualizerOptions | false;
|
|
2029
|
-
watch?: RollupOptions["watch"];
|
|
2030
|
-
wsam?: RollupWasmOptions | false;
|
|
2031
|
-
}
|
|
2032
|
-
type BuildEntry = {
|
|
2033
|
-
declaration?: boolean | "compatible" | "node16";
|
|
2034
|
-
input: string;
|
|
2035
|
-
isExecutable?: boolean;
|
|
2036
|
-
name?: string;
|
|
2037
|
-
outDir?: string;
|
|
2038
|
-
};
|
|
2039
|
-
interface BuildOptions {
|
|
2040
|
-
alias: Record<string, string>;
|
|
2041
|
-
cjsInterop?: boolean;
|
|
2042
|
-
clean: boolean;
|
|
2043
|
-
declaration?: boolean | "compatible" | "node16";
|
|
2044
|
-
dependencies: string[];
|
|
2045
|
-
devDependencies: string[];
|
|
2046
|
-
emitCJS?: boolean;
|
|
2047
|
-
emitESM?: boolean;
|
|
2048
|
-
entries: BuildEntry[];
|
|
2049
|
-
externals: (RegExp | string)[];
|
|
2050
|
-
failOnWarn?: boolean;
|
|
2051
|
-
name: string;
|
|
2052
|
-
optionalDependencies: string[];
|
|
2053
|
-
outDir: string;
|
|
2054
|
-
peerDependencies: string[];
|
|
2055
|
-
replace: Record<string, string>;
|
|
2056
|
-
rollup: RollupBuildOptions;
|
|
2057
|
-
rootDir: string;
|
|
2058
|
-
sourcemap: boolean;
|
|
2059
|
-
stub: boolean;
|
|
2060
|
-
stubOptions: {
|
|
2061
|
-
jiti: Omit<JITIOptions, "onError" | "transform">;
|
|
2062
|
-
};
|
|
2063
|
-
target: string;
|
|
2064
|
-
transformer: "esbuild" | "sucrase" | "swc" | undefined;
|
|
2065
|
-
}
|
|
2066
|
-
interface BuildHooks {
|
|
2067
|
-
"build:before": (context: BuildContext) => Promise<void> | void;
|
|
2068
|
-
"build:done": (context: BuildContext) => Promise<void> | void;
|
|
2069
|
-
"build:prepare": (context: BuildContext) => Promise<void> | void;
|
|
2070
|
-
"rollup:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
|
|
2071
|
-
"rollup:done": (context: BuildContext) => Promise<void> | void;
|
|
2072
|
-
"rollup:dts:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
|
|
2073
|
-
"rollup:dts:done": (context: BuildContext) => Promise<void> | void;
|
|
2074
|
-
"rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
2075
|
-
"rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
2076
|
-
"rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
|
|
2077
|
-
}
|
|
2078
|
-
type BuildContextBuildEntry = {
|
|
2079
|
-
bytes?: number;
|
|
2080
|
-
chunk?: boolean;
|
|
2081
|
-
chunks?: string[];
|
|
2082
|
-
exports?: string[];
|
|
2083
|
-
modules?: {
|
|
2084
|
-
bytes: number;
|
|
2085
|
-
id: string;
|
|
2086
|
-
}[];
|
|
2087
|
-
path: string;
|
|
2088
|
-
type?: "asset" | "chunk" | "entry";
|
|
2089
|
-
};
|
|
2090
|
-
interface BuildContext {
|
|
2091
|
-
buildEntries: BuildContextBuildEntry[];
|
|
2092
|
-
dependencyGraphMap: Map<string, Set<[string, string]>>;
|
|
2093
|
-
hooks: Hookable<BuildHooks>;
|
|
2094
|
-
logger: Pail<never, string>;
|
|
2095
|
-
mode: Mode;
|
|
2096
|
-
options: BuildOptions;
|
|
2097
|
-
pkg: PackageJson;
|
|
2098
|
-
rootDir: string;
|
|
2099
|
-
tsconfig?: TsConfigResult;
|
|
2100
|
-
usedImports: Set<string>;
|
|
2101
|
-
warnings: Set<string>;
|
|
2102
|
-
}
|
|
2103
|
-
type BuildPreset = BuildConfig | (() => BuildConfig);
|
|
2104
|
-
interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
|
|
2105
|
-
entries?: (BuildEntry | string)[];
|
|
2106
|
-
hooks?: Partial<BuildHooks>;
|
|
2107
|
-
preset?: BuildPreset | string;
|
|
2108
|
-
}
|
|
2109
|
-
type Mode = "build" | "jit" | "watch";
|
|
2110
|
-
|
|
2111
|
-
export type { BuildConfig as B, Mode as M, BuildPreset as a, BuildHooks as b };
|
|
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.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
|
+
dependenciesMarker?: string;
|
|
43
|
+
dependenciesTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
44
|
+
dtsMarker?: string;
|
|
45
|
+
dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
46
|
+
path?: 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";const s=require("@rollup/plugin-node-resolve"),e=[...s.DEFAULTS.extensions,".cjs"],f=[...e,".ts",".cts",".mts",".tsx",".jsx"],i={".aac":"file",".cjs":"js",".css":"file",".cts":"ts",".eot":"file",".flac":"file",".gif":"file",".jpeg":"file",".jpg":"file",".js":"js",".json":"json",".jsx":"jsx",".mjs":"js",".mp3":"file",".mp4":"file",".mts":"ts",".ogg":"file",".otf":"file",".png":"file",".svg":"file",".ts":"ts",".tsx":"tsx",".ttf":"file",".wav":"file",".webm":"file",".webp":"file",".woff":"file",".woff2":"file"},E=/node_modules/;exports.DEFAULT_EXTENSIONS=f;exports.DEFAULT_LOADERS=i;exports.EXCLUDE_REGEXP=E;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{DEFAULTS as s}from"@rollup/plugin-node-resolve";
|
|
2
|
+
// -- pack CommonJS Shims --
|
|
3
|
+
import __cjs_url__ from "node:url";
|
|
4
|
+
import __cjs_path__ from "node:path";
|
|
5
|
+
import __cjs_mod__ from "node:module";
|
|
6
|
+
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
+
const e=[...s.extensions,".cjs"],i=[...e,".ts",".cts",".mts",".tsx",".jsx"],l={".aac":"file",".cjs":"js",".css":"file",".cts":"ts",".eot":"file",".flac":"file",".gif":"file",".jpeg":"file",".jpg":"file",".js":"js",".json":"json",".jsx":"jsx",".mjs":"js",".mp3":"file",".mp4":"file",".mts":"ts",".ogg":"file",".otf":"file",".png":"file",".svg":"file",".ts":"ts",".tsx":"tsx",".ttf":"file",".wav":"file",".webm":"file",".webp":"file",".woff":"file",".woff2":"file"},t=/node_modules/;export{l as D,t as E,i as a};
|
|
@@ -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,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 };
|
package/package.json
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.21",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"zero config",
|
|
11
|
-
"package.json",
|
|
12
|
-
"exports",
|
|
13
|
-
"esm",
|
|
7
|
+
"assets",
|
|
8
|
+
"bundle",
|
|
9
|
+
"bundler",
|
|
14
10
|
"cjs",
|
|
15
11
|
"commonjs",
|
|
12
|
+
"compiler",
|
|
13
|
+
"css",
|
|
14
|
+
"declaration",
|
|
15
|
+
"es6",
|
|
16
|
+
"esbuild",
|
|
17
|
+
"esm",
|
|
18
|
+
"exports",
|
|
19
|
+
"package.json",
|
|
20
|
+
"packem",
|
|
21
|
+
"rollup",
|
|
22
|
+
"sucrase",
|
|
23
|
+
"swc",
|
|
16
24
|
"typescript",
|
|
17
|
-
"
|
|
25
|
+
"visulima",
|
|
26
|
+
"zero config"
|
|
18
27
|
],
|
|
19
28
|
"homepage": "https://www.visulima.com/docs/package/packem",
|
|
20
29
|
"repository": {
|
|
@@ -60,6 +69,36 @@
|
|
|
60
69
|
"default": "./dist/config.mjs"
|
|
61
70
|
}
|
|
62
71
|
},
|
|
72
|
+
"./transformer/esbuild": {
|
|
73
|
+
"require": {
|
|
74
|
+
"types": "./dist/rollup/plugins/esbuild/index.d.cts",
|
|
75
|
+
"default": "./dist/rollup/plugins/esbuild/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"import": {
|
|
78
|
+
"types": "./dist/rollup/plugins/esbuild/index.d.mts",
|
|
79
|
+
"default": "./dist/rollup/plugins/esbuild/index.mjs"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./transformer/swc": {
|
|
83
|
+
"require": {
|
|
84
|
+
"types": "./dist/rollup/plugins/swc/index.d.cts",
|
|
85
|
+
"default": "./dist/rollup/plugins/swc/index.cjs"
|
|
86
|
+
},
|
|
87
|
+
"import": {
|
|
88
|
+
"types": "./dist/rollup/plugins/swc/index.d.mts",
|
|
89
|
+
"default": "./dist/rollup/plugins/swc/index.mjs"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"./transformer/sucrase": {
|
|
93
|
+
"require": {
|
|
94
|
+
"types": "./dist/rollup/plugins/sucrase/index.d.cts",
|
|
95
|
+
"default": "./dist/rollup/plugins/sucrase/index.cjs"
|
|
96
|
+
},
|
|
97
|
+
"import": {
|
|
98
|
+
"types": "./dist/rollup/plugins/sucrase/index.d.mts",
|
|
99
|
+
"default": "./dist/rollup/plugins/sucrase/index.mjs"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
63
102
|
"./package.json": "./package.json"
|
|
64
103
|
},
|
|
65
104
|
"main": "./dist/create-bundler.cjs",
|
|
@@ -75,6 +114,7 @@
|
|
|
75
114
|
"LICENSE.md"
|
|
76
115
|
],
|
|
77
116
|
"dependencies": {
|
|
117
|
+
"@antfu/install-pkg": "^0.3.3",
|
|
78
118
|
"@babel/parser": "^7.24.6",
|
|
79
119
|
"@rollup/plugin-alias": "^5.1.0",
|
|
80
120
|
"@rollup/plugin-commonjs": "^25.0.8",
|
|
@@ -88,10 +128,11 @@
|
|
|
88
128
|
"@visulima/cerebro": "^1.0.28",
|
|
89
129
|
"@visulima/colorize": "^1.4.1",
|
|
90
130
|
"@visulima/fs": "^2.1.2",
|
|
91
|
-
"@visulima/humanizer": "^1.0.
|
|
131
|
+
"@visulima/humanizer": "^1.0.3",
|
|
92
132
|
"@visulima/package": "^1.8.2",
|
|
93
133
|
"@visulima/pail": "^1.1.11",
|
|
94
134
|
"@visulima/path": "^1.0.1",
|
|
135
|
+
"@clack/prompts": "^0.7.0",
|
|
95
136
|
"defu": "6.1.4",
|
|
96
137
|
"es-module-lexer": "^1.5.3",
|
|
97
138
|
"fastest-levenshtein": "^1.0.16",
|
|
@@ -129,7 +170,7 @@
|
|
|
129
170
|
"@vitest/coverage-v8": "^1.6.0",
|
|
130
171
|
"@vitest/ui": "^1.6.0",
|
|
131
172
|
"cross-env": "^7.0.3",
|
|
132
|
-
"esbuild": "^0.21.
|
|
173
|
+
"esbuild": "^0.21.4",
|
|
133
174
|
"eslint": "^8.56.0",
|
|
134
175
|
"eslint-plugin-deprecation": "^2.0.0",
|
|
135
176
|
"eslint-plugin-etc": "^2.0.3",
|
|
@@ -152,12 +193,11 @@
|
|
|
152
193
|
"tempy": "^3.1.0",
|
|
153
194
|
"ts-essentials": "^10.0.0",
|
|
154
195
|
"typescript": "^5.4.5",
|
|
155
|
-
"vitest": "^1.6.0"
|
|
156
|
-
"vue": "^3.4.27"
|
|
196
|
+
"vitest": "^1.6.0"
|
|
157
197
|
},
|
|
158
198
|
"peerDependencies": {
|
|
159
|
-
"@swc/core": "^1.
|
|
160
|
-
"esbuild": "^0.20.2",
|
|
199
|
+
"@swc/core": "^1.5.7",
|
|
200
|
+
"esbuild": "^0.20.2 || ^0.21.3",
|
|
161
201
|
"jiti": "^1.21.0",
|
|
162
202
|
"sucrase": "^3.35.0",
|
|
163
203
|
"typescript": "^4.5 || ^5.0"
|
|
@@ -203,8 +243,8 @@
|
|
|
203
243
|
}
|
|
204
244
|
},
|
|
205
245
|
"scripts": {
|
|
206
|
-
"build": "cross-env JITI_ESM_RESOLVE=1 jiti ./src/cli",
|
|
207
|
-
"build:prod": "cross-env JITI_ESM_RESOLVE=1 jiti ./src/cli --minify",
|
|
246
|
+
"build": "cross-env JITI_ESM_RESOLVE=1 INTERNAL_PACKEM_BUILD=1 jiti ./src/cli build",
|
|
247
|
+
"build:prod": "cross-env JITI_ESM_RESOLVE=1 INTERNAL_PACKEM_BUILD=1 jiti ./src/cli build --minify",
|
|
208
248
|
"clean": "rimraf node_modules dist .eslintcache",
|
|
209
249
|
"dev": "pnpm run build",
|
|
210
250
|
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
package/dist/chunks/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var a=(s,r)=>y(s,"name",{value:r,configurable:!0});const f=require("node:fs"),q=require("@rollup/pluginutils"),g=require("@swc/core"),d=require("@visulima/path"),p=require("../shared/packem.e4bzQy8N.cjs"),E=require("../shared/packem.CEXB7aOL.cjs");var w=Object.defineProperty,x=a((s,r)=>w(s,"name",{value:r,configurable:!0}),"a");const F=x(({exclude:s,extensions:r=p.DEFAULT_EXTENSIONS,include:m,...v})=>{const l=q.createFilter(m,s??p.EXCLUDE_REGEXP),o=new Map;return{async resolveId(e,t,{isEntry:u}){if(!t||u||!l(e)||e.startsWith("\0"))return null;const i=o.get(e);if(i!==void 0)return i;if(t&&e.startsWith(".")){const c=d.resolve(t?d.dirname(t):process.cwd(),e);let n=E.x(r,c);if(n||!n&&f.existsSync(c)&&f.statSync(c).isDirectory()&&(n=E.x(r,c,!0),n))return o.set(e,n),n}return o.set(e,null),null},async transform(e,t){if(!l(t))return null;const{code:u,map:i}=await g.transform(e,{...v,configFile:!1,filename:t,swcrc:!1});return{code:u,map:i}}}},"swcPlugin");exports.default=F;
|
package/dist/chunks/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var d=Object.defineProperty;var f=(o,e)=>d(o,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{transform as w}from"@swc/core";import{resolve as x,dirname as g}from"@visulima/path";import{E as D,D as S}from"../shared/packem.BF9udlBc.mjs";import{x as m}from"../shared/packem.Bdmp1hC5.mjs";var F=Object.defineProperty,I=f((o,e)=>F(o,"name",{value:e,configurable:!0}),"a");const P=I(({exclude:o,extensions:e=S,include:u,...p})=>{const l=v(u,o??D),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=x(r?g(r):process.cwd(),t);let n=m(e,i);if(n||!n&&E(i)&&y(i).isDirectory()&&(n=m(e,i,!0),n))return a.set(t,n),n}return a.set(t,null),null},async transform(t,r){if(!l(r))return null;const{code:c,map:s}=await w(t,{...p,configFile:!1,filename:r,swcrc:!1});return{code:c,map:s}}}},"swcPlugin");export{P as default};
|
package/dist/chunks/index2.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var g=(e,r)=>$(e,"name",{value:r,configurable:!0});const _=require("node:fs"),P=require("@rollup/pluginutils"),h=require("@visulima/path"),v=require("esbuild"),x=require("../shared/packem.e4bzQy8N.cjs"),z=require("../shared/packem.CEXB7aOL.cjs"),R=require("node:fs/promises"),F=require("@visulima/package"),j=require("es-module-lexer");var L=Object.defineProperty,S=g((e,r)=>L(e,"name",{value:r,configurable:!0}),"t$1");const E=S(async(e,r)=>{r.length>0&&(await v.formatMessages(r,{color:!0,kind:"warning"})).forEach(l=>e.warn(l))},"warn");var W=Object.defineProperty,k=g((e,r)=>W(e,"name",{value:r,configurable:!0}),"t");const A=k(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),C=k(({sourceMap:e=!0,...r})=>async function(l,o,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const n=A(i.format),c=await v.transform(l,{format:n,loader:"js",sourcemap:e,...r});if(await E(this,c.warnings),c.code)return{code:c.code,map:c.map||null}}return null},"getRenderChunk");var I=Object.defineProperty,q=g((e,r)=>I(e,"name",{value:r,configurable:!0}),"o");const O=q(e=>e.replaceAll("\\","/"),"slash"),U=q(async e=>{const r=await F.findCacheDirectory("packem/optimize_deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await j.init,await v.build({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(o){o.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(i.pluginData?.__resolving_dep_path__)return null;if(e.include.includes(i.path)){const n=await o.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return n.errors.length>0||n.warnings.length>0?n:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:n.path,resolveDir:i.resolveDir}}}return null}),o.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:n,resolveDir:c}=i.pluginData,u=await R.readFile(n,"utf8"),[,f]=j.parse(u);return{contents:f.length>0?`export * from '${O(n)}'`:`module.exports = require('${O(n)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins||[]]});const l=new Map;for(const o of e.include)l.set(o,{file:h.join(r,`${o}.js`)});return{cacheDir:r,optimized:l}},"optimizeDeps");var X=Object.defineProperty,B=g((e,r)=>X(e,"name",{value:r,configurable:!0}),"E");const G=B(({exclude:e,include:r,loaders:l,logger:o,optimizeDeps:i,sourceMap:n=!0,...c})=>{const u=x.DEFAULT_LOADERS;if(l)for(let[t,a]of Object.entries(l))t=t.startsWith(".")?t:`.${t}`,typeof a=="string"?u[t]=a:a||delete u[t];const f=Object.keys(u),M=new RegExp(`\\.(${f.map(t=>t.slice(1)).join("|")})$`),b=P.createFilter(r||M,e||x.EXCLUDE_REGEXP);let p,D=process.cwd();const w=new Map;return{async buildStart(){!i||p||(p=await U({cwd:D,sourceMap:n,...i}),o.debug("optimized %O",p.optimized))},name:"esbuild",options({context:t}){return t&&(D=t),null},renderChunk:C({...c,sourceMap:n}),async resolveId(t,a,{isEntry:y}){if(!a||y||!b(t)||t.startsWith("\0"))return null;if(p?.optimized.has(t)){const s=p.optimized.get(t);if(s)return o.debug("resolved %s to %s",t,s.file),s.file}const d=w.get(t);if(d!==void 0)return d;if(a&&t.startsWith(".")){const s=h.resolve(a?h.dirname(a):process.cwd(),t);let m=z.x(f,s);if(m||!m&&_.existsSync(s)&&_.statSync(s).isDirectory()&&(m=z.x(f,s,!0),m))return w.set(t,m),m}return w.set(t,null),null},async transform(t,a){if(!b(a)||p?.optimized.has(a))return null;const y=h.extname(a),d=u[y];if(!d)return null;const s=await v.transform(t,{format:["base64","binary","dataurl","text","json"].includes(d)?"esm":void 0,loader:d,sourcefile:a.replace(/\.[cm]ts/,".ts"),sourcemap:n,...c});return await E(this,s.warnings),s.code?{code:s.code,map:s.map||null}:null}}},"default");exports.default=G;
|