@visulima/packem 1.0.0-alpha.38 → 1.0.0-alpha.39
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 +7 -0
- package/dist/cli.cjs +8 -0
- package/dist/cli.mjs +2 -2
- package/dist/config.cjs +1 -0
- package/dist/config.d.cts +27 -0
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/create-bundler.cjs +101 -0
- package/dist/create-bundler.d.cts +29 -0
- package/dist/create-bundler.d.mts +1 -1
- package/dist/create-bundler.d.ts +1 -1
- package/dist/create-bundler.mjs +60 -52
- package/dist/rollup/plugins/esbuild/index.cjs +1 -0
- package/dist/rollup/plugins/esbuild/index.d.cts +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/swc/index.cjs +1 -0
- package/dist/rollup/plugins/swc/index.d.cts +7 -0
- package/dist/shared/{packem.uSaRQP_b.d.mts → packem.BBXO6_87.d.mts} +1 -0
- package/dist/shared/packem.CEXB7aOL.cjs +1 -0
- package/dist/shared/packem.ClcPYkxx.d.cts +184 -0
- package/dist/shared/packem.D09xRBAa.d.cts +25 -0
- package/dist/shared/{packem.CkrxFqbp.d.ts → packem.DtAA_1Hu.d.ts} +1 -0
- package/dist/shared/packem.DvWhOdt5.d.cts +10 -0
- package/dist/shared/packem.NVRVuzg1.cjs +1 -0
- package/dist/shared/packem.aYVbzCkK.d.cts +1919 -0
- package/package.json +48 -18
|
@@ -0,0 +1 @@
|
|
|
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"),x=require("@swc/core"),d=require("@visulima/path"),p=require("../../../shared/packem.NVRVuzg1.cjs"),E=require("../../../shared/packem.CEXB7aOL.cjs");var g=Object.defineProperty,w=a((s,r)=>g(s,"name",{value:r,configurable:!0}),"a");const F=w(({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 x.transform(e,{...v,configFile:!1,filename:t,swcrc:!1});return{code:u,map:i}}}},"swcPlugin");module.exports=F;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Plugin } from 'rollup';
|
|
2
|
+
import { S as SwcPluginConfig } from '../../../shared/packem.aYVbzCkK.cjs';
|
|
3
|
+
import '@rollup/pluginutils';
|
|
4
|
+
|
|
5
|
+
declare const swcPlugin: ({ exclude, extensions, include, ...transformOptions }: SwcPluginConfig) => Plugin;
|
|
6
|
+
|
|
7
|
+
export { swcPlugin as default };
|
|
@@ -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,184 @@
|
|
|
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.aYVbzCkK.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 Runtime = "react-server" | "react-native" | "edge-light" | "node";
|
|
95
|
+
type BuildEntry = {
|
|
96
|
+
cjs?: boolean;
|
|
97
|
+
declaration?: boolean | "compatible" | "node16";
|
|
98
|
+
environment?: "production" | "development";
|
|
99
|
+
esm?: boolean;
|
|
100
|
+
executable?: boolean;
|
|
101
|
+
input: string;
|
|
102
|
+
name?: string;
|
|
103
|
+
outDir?: string;
|
|
104
|
+
runtime?: Runtime;
|
|
105
|
+
};
|
|
106
|
+
interface BuildOptions {
|
|
107
|
+
alias: Record<string, string>;
|
|
108
|
+
cjsInterop?: boolean;
|
|
109
|
+
clean: boolean;
|
|
110
|
+
debug: boolean;
|
|
111
|
+
declaration?: boolean | "compatible" | "node16" | undefined;
|
|
112
|
+
dependencies: string[];
|
|
113
|
+
devDependencies: string[];
|
|
114
|
+
emitCJS?: boolean;
|
|
115
|
+
emitESM?: boolean;
|
|
116
|
+
entries: BuildEntry[];
|
|
117
|
+
externals: (RegExp | string)[];
|
|
118
|
+
failOnWarn?: boolean;
|
|
119
|
+
fileCache?: boolean;
|
|
120
|
+
minify: boolean;
|
|
121
|
+
name: string;
|
|
122
|
+
optionalDependencies: string[];
|
|
123
|
+
outDir: string;
|
|
124
|
+
peerDependencies: string[];
|
|
125
|
+
replace: Record<string, string>;
|
|
126
|
+
rollup: RollupBuildOptions;
|
|
127
|
+
rootDir: string;
|
|
128
|
+
sourceDir: string;
|
|
129
|
+
sourcemap: boolean;
|
|
130
|
+
stub: boolean;
|
|
131
|
+
stubOptions: {
|
|
132
|
+
jiti: Omit<JITIOptions, "onError" | "transform">;
|
|
133
|
+
};
|
|
134
|
+
transformer?: (config: SwcPluginConfig | SucrasePluginConfig | EsbuildPluginConfig) => Plugin;
|
|
135
|
+
}
|
|
136
|
+
interface BuildHooks {
|
|
137
|
+
"build:before": (context: BuildContext) => Promise<void> | void;
|
|
138
|
+
"build:done": (context: BuildContext) => Promise<void> | void;
|
|
139
|
+
"build:prepare": (context: BuildContext) => Promise<void> | void;
|
|
140
|
+
"rollup:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
|
|
141
|
+
"rollup:done": (context: BuildContext) => Promise<void> | void;
|
|
142
|
+
"rollup:dts:build": (context: BuildContext, build: RollupBuild) => Promise<void> | void;
|
|
143
|
+
"rollup:dts:done": (context: BuildContext) => Promise<void> | void;
|
|
144
|
+
"rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
145
|
+
"rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
146
|
+
"rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
|
|
147
|
+
}
|
|
148
|
+
type BuildContextBuildEntry = {
|
|
149
|
+
bytes?: number;
|
|
150
|
+
chunk?: boolean;
|
|
151
|
+
chunks?: string[];
|
|
152
|
+
exports?: string[];
|
|
153
|
+
modules?: {
|
|
154
|
+
bytes: number;
|
|
155
|
+
id: string;
|
|
156
|
+
}[];
|
|
157
|
+
path: string;
|
|
158
|
+
type?: "asset" | "chunk" | "entry";
|
|
159
|
+
};
|
|
160
|
+
interface InternalBuildOptions extends BuildOptions {
|
|
161
|
+
transformerName: "esbuild" | "sucrase" | "swc" | undefined;
|
|
162
|
+
}
|
|
163
|
+
interface BuildContext {
|
|
164
|
+
buildEntries: BuildContextBuildEntry[];
|
|
165
|
+
dependencyGraphMap: Map<string, Set<[string, string]>>;
|
|
166
|
+
hooks: Hookable<BuildHooks>;
|
|
167
|
+
logger: Pail<never, string>;
|
|
168
|
+
mode: Mode;
|
|
169
|
+
options: InternalBuildOptions;
|
|
170
|
+
pkg: PackageJson;
|
|
171
|
+
rootDir: string;
|
|
172
|
+
tsconfig?: TsConfigResult;
|
|
173
|
+
usedImports: Set<string>;
|
|
174
|
+
warnings: Set<string>;
|
|
175
|
+
}
|
|
176
|
+
type BuildPreset = BuildConfig | (() => BuildConfig);
|
|
177
|
+
interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
|
|
178
|
+
entries?: (BuildEntry | string)[];
|
|
179
|
+
hooks?: Partial<BuildHooks>;
|
|
180
|
+
preset?: BuildPreset | string;
|
|
181
|
+
}
|
|
182
|
+
type Mode = "build" | "jit" | "watch";
|
|
183
|
+
|
|
184
|
+
export type { BuildConfig as B, Mode as M, BuildPreset as a, BuildHooks as b };
|
|
@@ -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 @@
|
|
|
1
|
+
"use strict";const s=require("@rollup/plugin-node-resolve"),t=[...s.DEFAULTS.extensions,".cjs",".ts",".cts",".mts",".tsx",".jsx"],f={".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"},i=["development","production"],e=["react-server","react-native","edge-light"];[...i,...e];const E=/node_modules/;exports.DEFAULT_EXTENSIONS=t;exports.DEFAULT_LOADERS=f;exports.EXCLUDE_REGEXP=E;exports.RUNTIME_EXPORT_CONVENTIONS=e;
|