@octohash/vite-config 0.3.4 → 0.4.0
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/dist/index.d.mts +1214 -171
- package/dist/index.mjs +471 -10713
- package/package.json +35 -34
package/dist/index.d.mts
CHANGED
|
@@ -1,195 +1,1238 @@
|
|
|
1
|
-
import * as vite from
|
|
2
|
-
import { AliasOptions,
|
|
3
|
-
import { PluginOptions
|
|
4
|
-
import { VitePluginFederationOptions } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Options
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { GeneratorOptions } from '@jspm/generator';
|
|
1
|
+
import * as vite from "vite";
|
|
2
|
+
import { AliasOptions, PluginOption, UserConfig } from "vite";
|
|
3
|
+
import { PluginOptions } from "vite-plugin-dts";
|
|
4
|
+
import { VitePluginFederationOptions } from "@originjs/vite-plugin-federation";
|
|
5
|
+
import { VitePluginVueDevToolsOptions } from "vite-plugin-vue-devtools";
|
|
6
|
+
import { PluginOptions as PluginOptions$1 } from "@intlify/unplugin-vue-i18n";
|
|
7
|
+
import { Options } from "unplugin-auto-import/types";
|
|
8
|
+
import { Options as Options$1 } from "unplugin-vue-components";
|
|
9
|
+
import { Options as Options$2 } from "unplugin-vue-router";
|
|
11
10
|
|
|
11
|
+
//#region src/plugins/app-loading/index.d.ts
|
|
12
12
|
interface AppLoadingPluginOptions {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
container?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
filepath?: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/common/log.d.ts
|
|
19
|
+
type Log = (type: string, message: string) => void;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region node_modules/.pnpm/@jspm+import-map@1.3.0/node_modules/@jspm/import-map/lib/map.d.ts
|
|
22
|
+
interface IImportMap {
|
|
23
|
+
imports?: Record<string, string>;
|
|
24
|
+
scopes?: {
|
|
25
|
+
[scope: string]: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
integrity?: {
|
|
28
|
+
[url: string]: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare class ImportMap implements IImportMap {
|
|
32
|
+
imports: Record<string, string>;
|
|
33
|
+
scopes: Record<string, Record<string, string>>;
|
|
34
|
+
integrity: Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* The absolute URL of the import map, for determining relative resolutions
|
|
37
|
+
* When using file:/// URLs this allows relative modules to be co-located
|
|
38
|
+
*/
|
|
39
|
+
mapUrl: URL | null;
|
|
40
|
+
/**
|
|
41
|
+
* The URL to use for root-level resolutions in the import map
|
|
42
|
+
* If null, root resolutions are not resolved and instead left as-is
|
|
43
|
+
*
|
|
44
|
+
* By default, rootUrl is null unless the mapUrl is an http or https URL,
|
|
45
|
+
* in which case it is taken to be the root of the mapUrl.
|
|
46
|
+
*/
|
|
47
|
+
rootUrl: URL | null;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new import map instance
|
|
50
|
+
*
|
|
51
|
+
* @param opts import map options, can be an optional bag of { map?, mapUrl?, rootUrl? } or just a direct mapUrl
|
|
52
|
+
*/
|
|
53
|
+
constructor(opts: {
|
|
54
|
+
map?: IImportMap;
|
|
55
|
+
mapUrl?: string | URL;
|
|
56
|
+
rootUrl?: string | URL | null;
|
|
57
|
+
} | string | URL);
|
|
58
|
+
/**
|
|
59
|
+
* Clones the import map
|
|
60
|
+
* @returns Cloned import map
|
|
61
|
+
*/
|
|
62
|
+
clone(): ImportMap;
|
|
63
|
+
/**
|
|
64
|
+
* Extends the import map mappings
|
|
65
|
+
* @param map Import map to extend with
|
|
66
|
+
* @param overrideScopes Set to true to have scopes be replacing instead of extending
|
|
67
|
+
* @returns ImportMap for chaining
|
|
68
|
+
*/
|
|
69
|
+
extend(map: IImportMap, overrideScopes?: boolean): this;
|
|
70
|
+
/**
|
|
71
|
+
* Performs an alphanumerical sort on the import map imports and scopes
|
|
72
|
+
* @returns ImportMap for chaining
|
|
73
|
+
*/
|
|
74
|
+
sort(): this;
|
|
75
|
+
/**
|
|
76
|
+
* Set a specific entry in the import map
|
|
77
|
+
*
|
|
78
|
+
* @param name Specifier to set
|
|
79
|
+
* @param target Target of the map
|
|
80
|
+
* @param parent Optional parent scope
|
|
81
|
+
* @returns ImportMap for chaining
|
|
82
|
+
*/
|
|
83
|
+
set(name: string, target: string, parent?: string): this;
|
|
84
|
+
/**
|
|
85
|
+
* @param target URL target
|
|
86
|
+
* @param integrity Integrity
|
|
87
|
+
*/
|
|
88
|
+
setIntegrity(target: string, integrity: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* @param target URL target
|
|
91
|
+
* @param integrity Integrity
|
|
92
|
+
*/
|
|
93
|
+
getIntegrity(target: string, integrity: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Bulk replace URLs in the import map
|
|
96
|
+
* Provide a URL ending in "/" to perform path replacements
|
|
97
|
+
*
|
|
98
|
+
* @param url {String} The URL to replace
|
|
99
|
+
* @param newUrl {String} The URL to replace it with
|
|
100
|
+
* @returns ImportMap for chaining
|
|
101
|
+
*/
|
|
102
|
+
replace(url: string, newUrl: string): this;
|
|
103
|
+
/**
|
|
104
|
+
* Groups subpath mappings into path mappings when multiple exact subpaths
|
|
105
|
+
* exist under the same path.
|
|
106
|
+
*
|
|
107
|
+
* For two mappings like { "base/a.js": "/a.js", "base/b.js": "/b.js" },
|
|
108
|
+
* these will be replaced with a single path mapping { "base/": "/" }.
|
|
109
|
+
* Groupings are done throughout all import scopes individually.
|
|
110
|
+
*
|
|
111
|
+
* @param targets Which sections to combine: 'scopes' (default) or 'both' (includes top-level imports)
|
|
112
|
+
* @returns ImportMap for chaining
|
|
113
|
+
*/
|
|
114
|
+
combineSubpaths(targets?: 'scopes' | 'both'): this;
|
|
115
|
+
/**
|
|
116
|
+
* Groups the import map scopes to shared URLs to reduce duplicate mappings.
|
|
117
|
+
*
|
|
118
|
+
* For two given scopes, "https://site.com/x/" and "https://site.com/y/",
|
|
119
|
+
* a single scope will be constructed for "https://site.com/" including
|
|
120
|
+
* their shared mappings, only retaining the scopes if they have differences.
|
|
121
|
+
*
|
|
122
|
+
* In the case where the scope is on the same origin as the mapUrl, the grouped
|
|
123
|
+
* scope is determined based on determining the common baseline over all local scopes
|
|
124
|
+
*
|
|
125
|
+
* @returns ImportMap for chaining
|
|
126
|
+
*/
|
|
127
|
+
flatten(): this;
|
|
128
|
+
/**
|
|
129
|
+
* Rebase the entire import map to a new mapUrl and rootUrl
|
|
130
|
+
*
|
|
131
|
+
* If the rootUrl is not provided, it will remain null if it was
|
|
132
|
+
* already set to null.
|
|
133
|
+
*
|
|
134
|
+
* Otherwise, just like the constructor options, the rootUrl
|
|
135
|
+
* will default to the mapUrl base if it is an http: or https:
|
|
136
|
+
* scheme URL, and null otherwise keeping absolute URLs entirely
|
|
137
|
+
* in-tact.
|
|
138
|
+
*
|
|
139
|
+
* @param mapUrl The new map URL to use
|
|
140
|
+
* @param rootUrl The new root URL to use
|
|
141
|
+
* @returns ImportMap for chaining
|
|
142
|
+
*/
|
|
143
|
+
rebase(mapUrl?: URL | string, rootUrl?: URL | string | null): this;
|
|
144
|
+
/**
|
|
145
|
+
* Perform a module resolution against the import map
|
|
146
|
+
*
|
|
147
|
+
* @param specifier Specifier to resolve
|
|
148
|
+
* @param parentUrl Parent URL to resolve against
|
|
149
|
+
* @returns Resolved URL string
|
|
150
|
+
*/
|
|
151
|
+
resolve(specifier: string, parentUrl?: string | URL): string;
|
|
152
|
+
/**
|
|
153
|
+
* Get the import map JSON data
|
|
154
|
+
*
|
|
155
|
+
* @returns Import map data
|
|
156
|
+
*/
|
|
157
|
+
toJSON(): IImportMap;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/providers/index.d.ts
|
|
161
|
+
interface Provider {
|
|
162
|
+
parseUrlPkg?(this: ProviderContext, url: string): ExactPackage | {
|
|
163
|
+
pkg: ExactPackage;
|
|
164
|
+
layer: string;
|
|
165
|
+
builtin: string | null;
|
|
166
|
+
} | null;
|
|
167
|
+
pkgToUrl?(this: ProviderContext, pkg: ExactPackage, layer?: string): `${string}/` | Promise<`${string}/`>;
|
|
168
|
+
resolveLatestTarget?(this: ProviderContext, target: LatestPackageTarget, layer: string, parentUrl: string, resolver: Resolver): Promise<ExactPackage | null>;
|
|
169
|
+
ownsUrl?(this: ProviderContext, url: string): boolean;
|
|
170
|
+
isBuiltin?(this: ProviderContext, specifier: string): boolean;
|
|
171
|
+
resolveBuiltin?(this: ProviderContext, specifier: string, env: string[]): string | {
|
|
172
|
+
target: PackageTarget;
|
|
173
|
+
subpath: '.' | `./${string}`;
|
|
174
|
+
} | null;
|
|
175
|
+
getPackageConfig?(this: ProviderContext, pkgUrl: string): Promise<PackageConfig | null>;
|
|
176
|
+
getFileList?(this: ProviderContext, pkgUrl: string): Promise<Set<string> | undefined>;
|
|
177
|
+
download?(this: ProviderContext, pkg: ExactPackage): Promise<Record<string, Uint8Array>>;
|
|
178
|
+
/**
|
|
179
|
+
* Publish a package to the provider
|
|
180
|
+
* This is an optional method that providers can implement to support package publishing
|
|
181
|
+
*
|
|
182
|
+
* @param importMap Optional import map to include with the publish
|
|
183
|
+
*/
|
|
184
|
+
publish?(this: ProviderContext, pkg: ExactPackage, files: Record<string, string | ArrayBuffer> | undefined, importMap: ImportMap | undefined, imports: string[]): Promise<PublishOutput>;
|
|
185
|
+
/**
|
|
186
|
+
* Authenticate with the provider
|
|
187
|
+
* This is an optional method that providers can implement to support authentication
|
|
188
|
+
*
|
|
189
|
+
* @param username Optional username for authentication
|
|
190
|
+
* @param verify Optional callback to verify authentication with the user
|
|
191
|
+
* @returns A promise resolving to an authentication token
|
|
192
|
+
*/
|
|
193
|
+
auth?(this: ProviderContext, options: {
|
|
194
|
+
username?: string;
|
|
195
|
+
verify?: (url: string, instructions: string) => void;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
token: string;
|
|
198
|
+
}>;
|
|
199
|
+
supportedLayers?: string[];
|
|
200
|
+
configure?(this: ProviderContext, config: any): void;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Context provided to all provider methods
|
|
204
|
+
* Contains necessary services and configuration
|
|
205
|
+
*/
|
|
206
|
+
declare class ProviderContext {
|
|
207
|
+
#private;
|
|
208
|
+
/**
|
|
209
|
+
* Logger instance for provider operations
|
|
210
|
+
*/
|
|
211
|
+
log: Log;
|
|
212
|
+
/**
|
|
213
|
+
* Fetch options for provider operations
|
|
214
|
+
*/
|
|
215
|
+
fetchOpts: any;
|
|
216
|
+
/**
|
|
217
|
+
* Custom context object for providers
|
|
218
|
+
*/
|
|
219
|
+
context: any;
|
|
220
|
+
constructor(pm: ProviderManager, log: Log, fetchOpts: any);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Provider manager to handle provider registration, lookup and operations
|
|
224
|
+
*/
|
|
225
|
+
declare class ProviderManager {
|
|
226
|
+
#private;
|
|
227
|
+
log: Log;
|
|
228
|
+
fetchOpts: any;
|
|
229
|
+
providers: Record<string, Provider>;
|
|
230
|
+
contexts: Record<string, ProviderContext>;
|
|
231
|
+
/**
|
|
232
|
+
* Create a new ProviderManager with the given providers
|
|
233
|
+
*
|
|
234
|
+
* @param customProviders Custom provider definitions to add
|
|
235
|
+
*/
|
|
236
|
+
constructor(log: Log, fetchOpts: any, providerConfig?: Record<string, any>, customProviders?: Record<string, Provider>);
|
|
237
|
+
/**
|
|
238
|
+
* Add a custom provider to this provider manager
|
|
239
|
+
*
|
|
240
|
+
* @param name Name of the provider
|
|
241
|
+
* @param provider Provider implementation
|
|
242
|
+
*/
|
|
243
|
+
addProvider(name: string, provider: Provider): void;
|
|
244
|
+
/**
|
|
245
|
+
* Find the provider name for a given URL
|
|
246
|
+
*
|
|
247
|
+
* @param url URL to find the provider for
|
|
248
|
+
* @returns The name of the provider, or null if no provider handles this URL
|
|
249
|
+
*/
|
|
250
|
+
providerNameForUrl(url: string): string | null;
|
|
251
|
+
/**
|
|
252
|
+
* Parse a URL to get package information
|
|
253
|
+
*
|
|
254
|
+
* @param url URL to parse
|
|
255
|
+
* @returns Package information or null if URL can't be parsed
|
|
256
|
+
*/
|
|
257
|
+
parseUrlPkg(url: string): {
|
|
258
|
+
pkg: ExactPackage;
|
|
259
|
+
source: {
|
|
260
|
+
provider: string;
|
|
261
|
+
layer: string;
|
|
262
|
+
};
|
|
263
|
+
builtin: string | null;
|
|
264
|
+
} | null;
|
|
265
|
+
/**
|
|
266
|
+
* Convert a package to a URL
|
|
267
|
+
*
|
|
268
|
+
* @param pkg Package to convert
|
|
269
|
+
* @param provider Provider name
|
|
270
|
+
* @param layer Layer to use
|
|
271
|
+
* @returns URL for the package
|
|
272
|
+
*/
|
|
273
|
+
pkgToUrl(pkg: ExactPackage, provider: string, layer?: string): `${string}/` | Promise<`${string}/`>;
|
|
274
|
+
/**
|
|
275
|
+
* Get the package config corresponding to a package URL
|
|
276
|
+
*
|
|
277
|
+
* @param pkgUrl URL to the package
|
|
278
|
+
* @returns
|
|
279
|
+
*/
|
|
280
|
+
getPackageConfig(pkgUrl: string): Promise<PackageConfig | null | undefined>;
|
|
281
|
+
/**
|
|
282
|
+
* Obtain a file listing of a package boundary if available
|
|
283
|
+
*/
|
|
284
|
+
getFileList(pkgUrl: string): Promise<Set<string> | undefined>;
|
|
285
|
+
/**
|
|
286
|
+
* Resolve a builtin module
|
|
287
|
+
*
|
|
288
|
+
* @param specifier Module specifier
|
|
289
|
+
* @returns Resolved string, install target and exports subpath, or undefined if not resolvable
|
|
290
|
+
*/
|
|
291
|
+
resolveBuiltin(specifier: string, env: string[]): string | {
|
|
292
|
+
target: PackageTarget;
|
|
293
|
+
subpath: '.' | `./${string}`;
|
|
294
|
+
} | undefined;
|
|
295
|
+
resolveLatestTarget(target: PackageTarget, {
|
|
296
|
+
provider,
|
|
297
|
+
layer
|
|
298
|
+
}: PackageProvider, parentUrl: string, resolver: Resolver): Promise<ExactPackage>;
|
|
299
|
+
/**
|
|
300
|
+
* Get the supported provider strings for all providers
|
|
301
|
+
*
|
|
302
|
+
* @returns List of provider string identifiers
|
|
303
|
+
*/
|
|
304
|
+
getProviderStrings(): string[];
|
|
305
|
+
/**
|
|
306
|
+
* Downloads the given package files into the local folder path outDir
|
|
307
|
+
* Does not include the import map, which must be merged separately.
|
|
308
|
+
*/
|
|
309
|
+
download(pkg: ExactPackage, providerName: string): Promise<Record<string, Uint8Array<ArrayBufferLike>>>;
|
|
310
|
+
/**
|
|
311
|
+
* Publish a package using the specified provider.
|
|
312
|
+
* A publish operation may be an import map only, files only, or both.
|
|
313
|
+
*
|
|
314
|
+
* @param pkg Package name, version and registry to publish
|
|
315
|
+
* @param providerName Name of the provider to use
|
|
316
|
+
* @param files Package files to publish
|
|
317
|
+
* @param importMap Optional import map to include with the publish
|
|
318
|
+
*/
|
|
319
|
+
publish(pkg: ExactPackage, providerName: string, imports: string[], files: undefined, importMap: undefined): Promise<PublishOutput>;
|
|
320
|
+
publish(pkg: ExactPackage, providerName: string, imports: string[], files: Record<string, string | ArrayBuffer>, importMap: undefined): Promise<PublishOutput>;
|
|
321
|
+
publish(pkg: ExactPackage, providerName: string, imports: string[], files: Record<string, string | ArrayBuffer>, importMap: ImportMap): Promise<PublishOutput>;
|
|
322
|
+
/**
|
|
323
|
+
* Authenticate with a provider to obtain an authentication token
|
|
324
|
+
*
|
|
325
|
+
* @param providerName Name of the provider to authenticate with
|
|
326
|
+
* @param options Authentication options
|
|
327
|
+
* @returns Promise resolving to the authentication token
|
|
328
|
+
*/
|
|
329
|
+
auth(providerName: string, options?: {
|
|
330
|
+
username?: string;
|
|
331
|
+
verify?: (url: string, instructions: string) => void;
|
|
332
|
+
}): Promise<{
|
|
333
|
+
token: string;
|
|
334
|
+
}>;
|
|
335
|
+
}
|
|
336
|
+
interface PublishOutput {
|
|
337
|
+
packageUrl: `${string}/`;
|
|
338
|
+
mapUrl: string;
|
|
339
|
+
codeSnippet?: string;
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/trace/resolver.d.ts
|
|
343
|
+
interface TraceEntry {
|
|
344
|
+
deps: string[];
|
|
345
|
+
dynamicDeps: string[];
|
|
346
|
+
hasStaticParent: boolean;
|
|
347
|
+
size: number;
|
|
348
|
+
integrity: string;
|
|
349
|
+
wasCjs: boolean;
|
|
350
|
+
usesCjs: boolean;
|
|
351
|
+
cjsLazyDeps: string[];
|
|
352
|
+
format: 'esm' | 'commonjs' | 'system' | 'json' | 'css' | 'typescript' | 'wasm';
|
|
353
|
+
parseError: Error;
|
|
354
|
+
}
|
|
355
|
+
declare class Resolver {
|
|
356
|
+
pcfgPromises: Record<string, Promise<PackageConfig | null>>;
|
|
357
|
+
analysisPromises: Record<string, Promise<void>>;
|
|
358
|
+
pcfgs: Record<string, PackageConfig | null>;
|
|
359
|
+
fetchOpts: any;
|
|
360
|
+
preserveSymlinks: any;
|
|
361
|
+
pm: ProviderManager;
|
|
362
|
+
traceEntries: Record<string, TraceEntry | null>;
|
|
363
|
+
traceEntryPromises: Record<string, Promise<void>>;
|
|
364
|
+
env: string[];
|
|
365
|
+
cjsEnv: string[];
|
|
366
|
+
traceCjs: boolean;
|
|
367
|
+
traceTs: boolean;
|
|
368
|
+
traceSystem: boolean;
|
|
369
|
+
installer: Installer;
|
|
370
|
+
visitedUrls: Set<string>;
|
|
371
|
+
constructor({
|
|
372
|
+
env,
|
|
373
|
+
fetchOpts,
|
|
374
|
+
providerManager,
|
|
375
|
+
packageConfigs,
|
|
376
|
+
preserveSymlinks,
|
|
377
|
+
traceCjs,
|
|
378
|
+
traceTs,
|
|
379
|
+
traceSystem
|
|
380
|
+
}: {
|
|
381
|
+
env: string[];
|
|
382
|
+
fetchOpts?: any;
|
|
383
|
+
preserveSymlinks?: boolean;
|
|
384
|
+
packageConfigs?: Record<`${string}/`, PackageConfig>;
|
|
385
|
+
traceCjs?: boolean;
|
|
386
|
+
traceTs?: boolean;
|
|
387
|
+
traceSystem: boolean;
|
|
388
|
+
providerManager: ProviderManager;
|
|
389
|
+
});
|
|
390
|
+
resolveBuiltin(specifier: string): string | {
|
|
391
|
+
target: PackageTarget;
|
|
392
|
+
subpath: '.' | `./${string}`;
|
|
393
|
+
} | undefined;
|
|
394
|
+
getPackageBase(url: string): `${string}/` | Promise<`${string}/`>;
|
|
395
|
+
getPackageConfig(pkgUrl: string): PackageConfig | null | Promise<PackageConfig | null>;
|
|
396
|
+
getFileList(pkgUrl: string): Promise<Set<string> | undefined>;
|
|
397
|
+
getDepList(pkgUrl: string, dev?: boolean): Promise<string[]>;
|
|
398
|
+
checkPjson(url: string): boolean | Promise<boolean>;
|
|
399
|
+
exists(resolvedUrl: string): Promise<boolean>;
|
|
400
|
+
wasCommonJS(url: string): Promise<boolean>;
|
|
401
|
+
realPath(url: string): Promise<string>;
|
|
402
|
+
finalizeResolve(url: string, parentIsCjs: boolean, exportsResolution: boolean, pkgUrl: `${string}/`): Promise<string>;
|
|
403
|
+
getExportResolution(pkgUrl: `${string}/`, subpath: '.' | `./${string}`, originalSpecifier: string): Promise<'.' | `./${string}` | null>;
|
|
404
|
+
resolveEmpty(cjsEnv: boolean, originalSpecifier: string, parentUrl: string): Promise<string>;
|
|
405
|
+
resolveExport(pkgUrl: `${string}/`, subpath: `.${string}`, cjsEnv: boolean, parentIsCjs: boolean, originalSpecifier: string, parentUrl?: string): Promise<string>;
|
|
406
|
+
getAnalysis(resolvedUrl: string): TraceEntry | null | undefined;
|
|
407
|
+
analyze(resolvedUrl: string): Promise<TraceEntry | null>;
|
|
408
|
+
resolvePackageTarget(target: ExportsTarget, packageUrl: string, cjsEnv: boolean, subpath: string, isImport: boolean): string | null;
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/install/lock.d.ts
|
|
412
|
+
interface LockResolutions {
|
|
413
|
+
primary: {
|
|
414
|
+
[pkgName: string]: InstalledResolution;
|
|
415
|
+
};
|
|
416
|
+
secondary: {
|
|
417
|
+
[pkgUrl: `${string}/`]: {
|
|
418
|
+
[pkgName: string]: InstalledResolution;
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
flattened: {
|
|
422
|
+
[scopeUrl: `${string}/`]: {
|
|
423
|
+
[pkgName: string]: FlatInstalledResolution[];
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
interface PackageToTarget {
|
|
428
|
+
[pkgName: string]: PackageTarget | URL;
|
|
429
|
+
}
|
|
430
|
+
interface VersionConstraints {
|
|
431
|
+
primary: PackageToTarget;
|
|
432
|
+
secondary: {
|
|
433
|
+
[pkgUrl: `${string}/`]: PackageToTarget;
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
interface InstalledResolution {
|
|
437
|
+
installUrl: `${string}/`;
|
|
438
|
+
}
|
|
439
|
+
interface FlatInstalledResolution {
|
|
440
|
+
export: `.${string}`;
|
|
441
|
+
resolution: InstalledResolution;
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/install/installer.d.ts
|
|
445
|
+
interface PackageProvider {
|
|
446
|
+
provider: string;
|
|
447
|
+
layer: string;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* InstallOptions configure the generator's behaviour for existing mappings
|
|
451
|
+
* in the import map. An existing mapping is considered "in-range" if either:
|
|
452
|
+
* 1. its parent package.json has no "dependencies" range for it
|
|
453
|
+
* 2. its semver version is within the parent's range
|
|
454
|
+
*
|
|
455
|
+
* The "latest-compatible version" of a package is the latest existing version
|
|
456
|
+
* within the parent's "dependencies range", or just the latest existing
|
|
457
|
+
* version if there is no such range.
|
|
458
|
+
*
|
|
459
|
+
* "default":
|
|
460
|
+
* New installs always resolve to the latest compatible version. Existing
|
|
461
|
+
* mappings are kept unless they are out-of-range, in which case they are
|
|
462
|
+
* bumped to the latest compatible version.
|
|
463
|
+
*
|
|
464
|
+
* "latest-primaries":
|
|
465
|
+
* Existing primary dependencies (i.e. mappings under "imports") are bumped
|
|
466
|
+
* to latest. Existing secondary dependencies are kept unless they are
|
|
467
|
+
* out-of-range, in which case they are bumped to the latest compatible
|
|
468
|
+
* version. New installs behave according to "default".
|
|
469
|
+
*
|
|
470
|
+
* "latest-all":
|
|
471
|
+
* All existing mappings are bumped to the latest compatible version. New
|
|
472
|
+
* installs behave according to "default".
|
|
473
|
+
*
|
|
474
|
+
* "freeze":
|
|
475
|
+
* No existing mappings are changed, and existing mappings are always used
|
|
476
|
+
* for new installs wherever possible. Completely new installs behave
|
|
477
|
+
* according to "default".
|
|
478
|
+
*/
|
|
479
|
+
type InstallMode = 'default' | 'latest-primaries' | 'latest-all' | 'freeze';
|
|
480
|
+
type InstallTarget = {
|
|
481
|
+
pkgTarget: PackageTarget | URL;
|
|
482
|
+
};
|
|
483
|
+
interface InstallerOptions {
|
|
484
|
+
mapUrl: URL;
|
|
485
|
+
baseUrl: URL;
|
|
486
|
+
rootUrl?: URL | null;
|
|
487
|
+
lock?: LockResolutions;
|
|
488
|
+
reset?: boolean;
|
|
489
|
+
prune?: boolean;
|
|
490
|
+
save?: boolean;
|
|
491
|
+
saveDev?: boolean;
|
|
492
|
+
savePeer?: boolean;
|
|
493
|
+
saveOptional?: boolean;
|
|
494
|
+
resolutions?: Record<string, string>;
|
|
495
|
+
defaultProvider?: string;
|
|
496
|
+
defaultRegistry?: string;
|
|
497
|
+
providers?: Record<string, string>;
|
|
498
|
+
}
|
|
499
|
+
declare class Installer {
|
|
500
|
+
opts: InstallerOptions;
|
|
501
|
+
installs: LockResolutions;
|
|
502
|
+
constraints: VersionConstraints;
|
|
503
|
+
newInstalls: boolean;
|
|
504
|
+
installBaseUrl: `${string}/`;
|
|
505
|
+
hasLock: boolean;
|
|
506
|
+
defaultProvider: {
|
|
507
|
+
provider: string;
|
|
508
|
+
layer: string;
|
|
509
|
+
};
|
|
510
|
+
defaultRegistry: string;
|
|
511
|
+
providers: Record<string, string>;
|
|
512
|
+
resolutions: Record<string, string>;
|
|
513
|
+
log: Log;
|
|
514
|
+
resolver: Resolver;
|
|
515
|
+
private _pkgUrls;
|
|
516
|
+
private _pkgsByKey;
|
|
517
|
+
private _constraintsByKey;
|
|
518
|
+
constructor(baseUrl: `${string}/`, opts: InstallerOptions, log: Log, resolver: Resolver);
|
|
519
|
+
visitInstalls(visitor: (scope: Record<string, InstalledResolution>, scopeUrl: string | null) => boolean | void): void;
|
|
520
|
+
getProvider(target: PackageTarget): {
|
|
521
|
+
provider: string;
|
|
522
|
+
layer: string;
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* Locks a package against the given target.
|
|
526
|
+
*
|
|
527
|
+
* @param {string} pkgName Name of the package being installed.
|
|
528
|
+
* @param {InstallTarget} target The installation target being installed.
|
|
529
|
+
* @param {InstallMode} mode Specifies how to interact with existing installs.
|
|
530
|
+
* @param {`${string}/` | null} pkgScope URL of the package scope in which this install is occurring, null if it's a top-level install.
|
|
531
|
+
* @param {string} parentUrl URL of the parent for this install.
|
|
532
|
+
* @returns {Promise<InstalledResolution>}
|
|
533
|
+
*/
|
|
534
|
+
installTarget(pkgName: string, {
|
|
535
|
+
pkgTarget
|
|
536
|
+
}: InstallTarget, mode: InstallMode, pkgScope: `${string}/` | null, parentUrl: string): Promise<InstalledResolution>;
|
|
537
|
+
installBuiltin(install: PackageTarget, specifier: string, mode: InstallMode, parentUrl: string): Promise<InstalledResolution>;
|
|
538
|
+
/**
|
|
539
|
+
* Installs the given package specifier.
|
|
540
|
+
*
|
|
541
|
+
* @param {string} pkgName The package specifier being installed.
|
|
542
|
+
* @param {InstallMode} mode Specifies how to interact with existing installs.
|
|
543
|
+
* @param {`${string}/` | null} pkgScope URL of the package scope in which this install is occurring, null if it's a top-level install.
|
|
544
|
+
* @param {`./${string}` | '.'} traceSubpath
|
|
545
|
+
* @param {string} parentUrl URL of the parent for this install.
|
|
546
|
+
* @returns {Promise<string | InstalledResolution>}
|
|
547
|
+
*/
|
|
548
|
+
install(pkgName: string, mode: InstallMode, pkgScope: `${string}/` | null, traceSubpath: `./${string}` | '.', parentUrl: string): Promise<InstalledResolution>;
|
|
549
|
+
private get pkgUrls();
|
|
550
|
+
private setResolution;
|
|
551
|
+
private setConstraint;
|
|
552
|
+
private getConstraintFor;
|
|
553
|
+
private buildPkgIndex;
|
|
554
|
+
private getBestExistingMatch;
|
|
555
|
+
private inRange;
|
|
556
|
+
private tryUpgradeAllTo;
|
|
557
|
+
private upgradeSupportedTo;
|
|
558
|
+
}
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/install/package.d.ts
|
|
561
|
+
/**
|
|
562
|
+
* ExportsTarget defines specifier mappings for the public entry points of a
|
|
563
|
+
* package, with support for conditionals.
|
|
564
|
+
* see https://nodejs.org/dist/latest-v19.x/docs/api/packages.html#exports
|
|
565
|
+
*/
|
|
566
|
+
type ExportsTarget = '.' | `./${string}` | null | {
|
|
567
|
+
[condition: string]: ExportsTarget;
|
|
568
|
+
} | ExportsTarget[];
|
|
569
|
+
/**
|
|
570
|
+
* PackageConfig is a parsed version of a package's package.json file.
|
|
571
|
+
* see https://nodejs.org/dist/latest-v19.x/docs/api/packages.html
|
|
572
|
+
*/
|
|
573
|
+
interface PackageConfig {
|
|
574
|
+
registry?: string;
|
|
575
|
+
name?: string;
|
|
576
|
+
version?: string;
|
|
577
|
+
main?: string;
|
|
578
|
+
files?: string[];
|
|
579
|
+
module?: string;
|
|
580
|
+
browser?: string | Record<string, string | false>;
|
|
581
|
+
imports?: Record<string, ExportsTarget>;
|
|
582
|
+
exports?: ExportsTarget | Record<string, ExportsTarget>;
|
|
583
|
+
type?: string;
|
|
584
|
+
dependencies?: Record<string, string>;
|
|
585
|
+
peerDependencies?: Record<string, string>;
|
|
586
|
+
optionalDependencies?: Record<string, string>;
|
|
587
|
+
devDependencies?: Record<string, string>;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* ExactPackage pins down an exact version of a package on an external registry,
|
|
591
|
+
* such as npm or deno.
|
|
592
|
+
*/
|
|
593
|
+
interface ExactPackage {
|
|
594
|
+
name: string;
|
|
595
|
+
registry: string;
|
|
596
|
+
version: string;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* PackageTarget pins down a particular version range of a package on an
|
|
600
|
+
* external registry, such as npm or deno.
|
|
601
|
+
*/
|
|
602
|
+
interface PackageTarget {
|
|
603
|
+
registry: string;
|
|
604
|
+
name: string;
|
|
605
|
+
range: any;
|
|
606
|
+
unstable: boolean;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* @deprecated Use PackageTarget directly — ranges are now singular.
|
|
610
|
+
*/
|
|
611
|
+
type LatestPackageTarget = PackageTarget;
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region node_modules/.pnpm/@jspm+generator@2.11.0/node_modules/@jspm/generator/lib/generator.d.ts
|
|
614
|
+
/**
|
|
615
|
+
* Cached analysis data for a module
|
|
616
|
+
*/
|
|
617
|
+
interface CachedAnalysis {
|
|
618
|
+
deps: string[];
|
|
619
|
+
dynamicDeps: string[];
|
|
620
|
+
size: number;
|
|
621
|
+
integrity: string;
|
|
622
|
+
format: 'json' | 'esm' | 'css' | 'wasm';
|
|
623
|
+
wasCjs: boolean;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Serializable cache structure for the Generator.
|
|
627
|
+
* Can be saved to disk and restored to speed up subsequent runs.
|
|
628
|
+
*/
|
|
629
|
+
interface GeneratorCache {
|
|
630
|
+
/** Package configurations keyed by full package URL */
|
|
631
|
+
packageConfigs: Record<string, PackageConfig | null>;
|
|
632
|
+
/** Module analysis data keyed by full module URL */
|
|
633
|
+
analysis: Record<string, CachedAnalysis>;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* @interface GeneratorOptions.
|
|
637
|
+
*/
|
|
638
|
+
interface GeneratorOptions {
|
|
639
|
+
/**
|
|
640
|
+
* The URL to use for resolutions without a parent context.
|
|
641
|
+
*
|
|
642
|
+
* Defaults to mapUrl or the process base URL.
|
|
643
|
+
*
|
|
644
|
+
* Also determines the default scoping base for the import map when flattening.
|
|
645
|
+
*/
|
|
646
|
+
baseUrl?: URL | string;
|
|
647
|
+
/**
|
|
648
|
+
* The URL of the import map itself, used to construct relative import map URLs.
|
|
649
|
+
*
|
|
650
|
+
* Defaults to the base URL.
|
|
651
|
+
*
|
|
652
|
+
* The `mapUrl` is used in order to output relative URLs for modules located on the same
|
|
653
|
+
* host as the import map.
|
|
654
|
+
*
|
|
655
|
+
* E.g. for `mapUrl: 'file:///path/to/project/map.importmap'`, installing local file packages
|
|
656
|
+
* will be output as relative URLs to their file locations from the map location, since all URLs in an import
|
|
657
|
+
* map are relative to the URL of the import map.
|
|
658
|
+
*/
|
|
659
|
+
mapUrl?: URL | string;
|
|
660
|
+
/**
|
|
661
|
+
* The URL to treat as the root of the serving protocol of the
|
|
662
|
+
* import map, used to construct absolute import map URLs.
|
|
663
|
+
*
|
|
664
|
+
* When set, `rootUrl` takes precendence over `mapUrl` and is used to normalize all import map URLs
|
|
665
|
+
* as absolute paths against this URL.
|
|
666
|
+
*
|
|
667
|
+
* E.g. for `rootUrl: 'file:///path/to/project/public'`, any local module `public/local/mod.js` within the `public` folder
|
|
668
|
+
* will be normalized to `/local/mod.js` in the output map.
|
|
669
|
+
*/
|
|
670
|
+
rootUrl?: URL | string | null;
|
|
671
|
+
/**
|
|
672
|
+
* An authoritative initial import map.
|
|
673
|
+
*
|
|
674
|
+
* An initial import map to start with - can be from a previous
|
|
675
|
+
* install or to provide custom mappings.
|
|
676
|
+
*/
|
|
677
|
+
inputMap?: IImportMap;
|
|
678
|
+
/**
|
|
679
|
+
* When using JSPM {@link Generator.link}, all dependencies
|
|
680
|
+
* will be placed into scopes instead of top-level "imports" in the map.
|
|
681
|
+
*
|
|
682
|
+
* This will default to true in the next major version.
|
|
683
|
+
*/
|
|
684
|
+
scopedLink?: boolean;
|
|
685
|
+
/**
|
|
686
|
+
* The provider to use for top-level (i.e. root package) installs if there's no context in the inputMap. This can be used to set the provider for a new import map. To use a specific provider for an install, rather than relying on context, register an override using the 'providers' option.
|
|
687
|
+
*
|
|
688
|
+
* Supports: 'jspm.io' | 'jspm.io#system' | 'nodemodules' | 'skypack' | 'jsdelivr' | 'unpkg' | 'esm.sh';
|
|
689
|
+
*
|
|
690
|
+
* Providers are responsible for resolution from abstract package names and version ranges to exact URL locations.
|
|
691
|
+
*
|
|
692
|
+
* Providers resolve package names and semver ranges to exact CDN package URL paths using provider hooks.
|
|
693
|
+
*
|
|
694
|
+
* These hooks include version resolution and converting package versions into URLs and back again.
|
|
695
|
+
*
|
|
696
|
+
* See `src/providers/[name].ts` for how to define a custom provider.
|
|
697
|
+
*
|
|
698
|
+
* New providers can be provided via the `customProviders` option. PRs to merge in providers are welcome as well.
|
|
699
|
+
*/
|
|
700
|
+
defaultProvider?: string;
|
|
701
|
+
/**
|
|
702
|
+
* The default registry to use when no registry is provided to an install.
|
|
703
|
+
* Defaults to 'npm:'.
|
|
704
|
+
*
|
|
705
|
+
* Registries are separated from providers because multiple providers can serve
|
|
706
|
+
* any public registry.
|
|
707
|
+
*
|
|
708
|
+
* Internally, the default providers for registries are handled by the providers object
|
|
709
|
+
*/
|
|
710
|
+
defaultRegistry?: string;
|
|
711
|
+
/**
|
|
712
|
+
* The conditional environment resolutions to apply.
|
|
713
|
+
*
|
|
714
|
+
* The conditions passed to the `env` option are environment conditions, as [supported by Node.js](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#packages_conditions_definitions) in the package exports field.
|
|
715
|
+
*
|
|
716
|
+
* By default the `"default"`, `"require"` and `"import"` conditions are always supported regardless of what `env` conditions are provided.
|
|
717
|
+
*
|
|
718
|
+
* In addition the default conditions applied if no `env` option is set are `"browser"`, `"development"` and `"module"`.
|
|
719
|
+
*
|
|
720
|
+
* Webpack and RollupJS support a custom `"module"` condition as a bundler-specific solution to the [dual package hazard](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#packages_dual_package_hazard), which is by default included in the JSPM resolution as well although
|
|
721
|
+
* can be turned off if needed.
|
|
722
|
+
*
|
|
723
|
+
* Note when providing custom conditions like setting `env: ["production"]` that the `"browser"` and `"module"` conditions still need to be
|
|
724
|
+
* applied as well via `env: ["production", "browser", "module"]`. Ordering does not matter though.
|
|
725
|
+
*
|
|
726
|
+
* Any other custom condition strings can also be provided.
|
|
727
|
+
*/
|
|
728
|
+
env?: string[];
|
|
729
|
+
/**
|
|
730
|
+
* Whether to use a local FS cache for fetched modules. Set to 'offline' to use the offline cache.
|
|
731
|
+
*
|
|
732
|
+
* By default a global fetch cache is maintained between runs on the file system.
|
|
733
|
+
*
|
|
734
|
+
* This caching can be disabled by setting `cache: false`.
|
|
735
|
+
*
|
|
736
|
+
* When running offline, setting `cache: 'offline'` will only use the local cache and not touch the network at all,
|
|
737
|
+
* making fully offline workflows possible provided the modules have been seen before.
|
|
738
|
+
*/
|
|
739
|
+
cache?: 'offline' | boolean;
|
|
740
|
+
/**
|
|
741
|
+
* User-provided fetch options for fetching modules, eg check https://github.com/npm/make-fetch-happen#extra-options for Node.js fetch
|
|
742
|
+
*/
|
|
743
|
+
fetchOptions?: Record<string, any>;
|
|
744
|
+
/**
|
|
745
|
+
* Custom provider definitions.
|
|
746
|
+
*
|
|
747
|
+
* When installing from a custom CDN it can be advisable to define a custom provider in order to be able to get version deduping against that CDN.
|
|
748
|
+
*
|
|
749
|
+
* Custom provider definitions define a provider name, and the provider instance consisting of three main hooks:
|
|
750
|
+
*
|
|
751
|
+
* * `pkgToUrl({ registry: string, name: string, version: string }, layer: string) -> String URL`: Returns the URL for a given exact package registry, name and version to use for this provider. If the provider is using layers, the `layer` string can be used to determine the URL layer (where the `defaultProvider: '[name].[layer]'` form is used to determine the layer, eg minified v unminified etc). It is important that package URLs always end in `/`, because packages must be treated as folders not files. An error will be thrown for package URLs returned not ending in `/`.
|
|
752
|
+
* * `parseUrlPkg(url: string) -> { { registry: string, name: string, version: string }, layer: string } | undefined`: Defines the converse operation to `pkgToUrl`, converting back from a string URL
|
|
753
|
+
* into the exact package registry, name and version, as well as the layer. Should always return `undefined` for unknown URLs as the first matching provider is treated as authoritative when dealing with
|
|
754
|
+
* multi-provider installations.
|
|
755
|
+
* * `resolveLatestTarget(target: { registry: string, name: string, range: SemverRange }, unstable: boolean, layer: string, parentUrl: string) -> Promise<{ registry: string, name: string, version: string } | null>`: Resolve the latest version to use for a given package target. `unstable` indicates that prerelease versions can be matched. The definition of `SemverRange` is as per the [sver package](https://www.npmjs.com/package/sver#semverrange). Returning `null` corresponds to a package not found error.
|
|
756
|
+
*
|
|
757
|
+
* The use of `pkgToUrl` and `parseUrlPkg` is what allows the JSPM Generator to dedupe package versions internally based on their unique internal identifier `[registry]:[name]@[version]` regardless of what CDN location is used. URLs that do not support `parseUrlPkg` can still be installed and used fine, they just do not participate in version deduping operations.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```js
|
|
761
|
+
* const unpkgUrl = 'https://unpkg.com/';
|
|
762
|
+
* const exactPkgRegEx = /^((?:@[^/\\%@]+\/)?[^./\\%@][^/\\%@]*)@([^\/]+)(\/.*)?$/;
|
|
763
|
+
*
|
|
764
|
+
* const generator = new Generator({
|
|
765
|
+
* defaultProvider: 'custom',
|
|
766
|
+
* customProviders: {
|
|
767
|
+
* custom: {
|
|
768
|
+
* pkgToUrl ({ registry, name, version }) {
|
|
769
|
+
* return `${unpkgUrl}${name}@${version}/`;
|
|
770
|
+
* },
|
|
771
|
+
* parseUrlPkg (url) {
|
|
772
|
+
* if (url.startsWith(unpkgUrl)) {
|
|
773
|
+
* const [, name, version] = url.slice(unpkgUrl.length).match(exactPkgRegEx) || [];
|
|
774
|
+
* return { registry: 'npm', name, version };
|
|
775
|
+
* }
|
|
776
|
+
* },
|
|
777
|
+
* resolveLatestTarget ({ registry, name, range }, unstable, layer, parentUrl) {
|
|
778
|
+
* return { registry, name, version: '3.6.0' };
|
|
779
|
+
* }
|
|
780
|
+
* }
|
|
781
|
+
* }
|
|
782
|
+
* });
|
|
783
|
+
*
|
|
784
|
+
* await generator.install('custom:jquery');
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
customProviders?: Record<string, Provider>;
|
|
788
|
+
/**
|
|
789
|
+
* A map of custom scoped providers.
|
|
790
|
+
*
|
|
791
|
+
* The provider map allows setting custom providers for specific package names, package scopes or registries.
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* For example, an organization with private packages with names like `npmpackage` and `@orgscope/...` can define the custom providers to reference these from a custom source:
|
|
795
|
+
*
|
|
796
|
+
* ```js
|
|
797
|
+
* providers: {
|
|
798
|
+
* 'npmpackage': 'nodemodules',
|
|
799
|
+
* '@orgscope': 'nodemodules',
|
|
800
|
+
* 'npm:': 'nodemodules'
|
|
801
|
+
* }
|
|
802
|
+
* ```
|
|
803
|
+
*
|
|
804
|
+
* Alternatively a custom provider can be referenced this way for eg private CDN / registry support.
|
|
805
|
+
*/
|
|
806
|
+
providers?: Record<string, string>;
|
|
807
|
+
/**
|
|
808
|
+
* Custom dependency resolution overrides for all installs.
|
|
809
|
+
*
|
|
810
|
+
* The resolutions option allows configuring a specific dependency version to always be used overriding all version resolution
|
|
811
|
+
* logic for that dependency for all nestings.
|
|
812
|
+
*
|
|
813
|
+
* It is a map from package name to package version target just like the package.json "dependencies" map, but that applies and overrides universally.
|
|
814
|
+
*
|
|
815
|
+
* @example
|
|
816
|
+
* ```js
|
|
817
|
+
* const generator = new Generator({
|
|
818
|
+
* resolutions: {
|
|
819
|
+
* dep: '1.2.3'
|
|
820
|
+
* }
|
|
821
|
+
* });
|
|
822
|
+
* ```
|
|
823
|
+
*
|
|
824
|
+
* It is also useful for local monorepo patterns where all local packages should be located locally.
|
|
825
|
+
* When referencing local paths, the baseUrl configuration option is used as the URL parent.
|
|
826
|
+
*
|
|
827
|
+
* ```js
|
|
828
|
+
* const generator = new Generator({
|
|
829
|
+
* mapUrl: new URL('./app.html', import.meta.url),
|
|
830
|
+
* baseUrl: new URL('../', import.meta.url),
|
|
831
|
+
* resolutions: {
|
|
832
|
+
* '@company/pkgA': `./pkgA`,
|
|
833
|
+
* '@company/pkgB': `./pkgB`
|
|
834
|
+
* '@company/pkgC': `./pkgC`
|
|
835
|
+
* }
|
|
836
|
+
* })
|
|
837
|
+
* ```
|
|
838
|
+
*
|
|
839
|
+
* All subpath and main resolution logic will follow the package.json definitions of the resolved package, unlike `inputMap`
|
|
840
|
+
* which only maps specific specifiers.
|
|
841
|
+
*/
|
|
842
|
+
resolutions?: Record<string, string>;
|
|
843
|
+
/**
|
|
844
|
+
* Override package.json configurations for package URLs.
|
|
845
|
+
*
|
|
846
|
+
* Key is a full normalized URL to a package path, optionally ending in `/` or `/package.json`.
|
|
847
|
+
* Value is a package configuration, as per a package.json file contents.
|
|
848
|
+
*
|
|
849
|
+
* This field can also be set to null to indicate no package configuration for this URL.
|
|
850
|
+
*
|
|
851
|
+
* This can be useful to remove 404 not found errors in browser workflows for URLs that
|
|
852
|
+
* clearly do not have a package.json.
|
|
853
|
+
*
|
|
854
|
+
* For example:
|
|
855
|
+
*
|
|
856
|
+
* const generator = new Generator({
|
|
857
|
+
* packageConfig: {
|
|
858
|
+
* 'https://mysite.com/': null
|
|
859
|
+
* }
|
|
860
|
+
* });
|
|
861
|
+
* generator.link('https://mysite.com/path/to/file.js');
|
|
862
|
+
*
|
|
863
|
+
* Can be used to avoid JSPM Generator from attempting to fetch `https://mysite.com/package.json` at all.
|
|
864
|
+
*/
|
|
865
|
+
packageConfigs?: Record<string, (PackageConfig & {
|
|
866
|
+
[key: string]: any;
|
|
867
|
+
}) | null>;
|
|
868
|
+
/**
|
|
869
|
+
* Allows ignoring certain module specifiers during the tracing process.
|
|
870
|
+
* It can be useful, for example, when you provide an `inputMap`
|
|
871
|
+
* that contains a mapping that can't be traced in current context,
|
|
872
|
+
* but you know it will work in the context where the generated map
|
|
873
|
+
* is going to be used.
|
|
874
|
+
* ```js
|
|
875
|
+
* const generator = new Generator({
|
|
876
|
+
* inputMap: {
|
|
877
|
+
* imports: {
|
|
878
|
+
* "react": "./my/own/react.js",
|
|
879
|
+
* }
|
|
880
|
+
* },
|
|
881
|
+
* ignore: ["react"]
|
|
882
|
+
* });
|
|
883
|
+
*
|
|
884
|
+
* // Even though `@react-three/fiber@7` depends upon `react`,
|
|
885
|
+
* // `generator` will not try to trace and resolve `react`,
|
|
886
|
+
* // so the mapping provided in `inputMap` will end up in the resulting import map.
|
|
887
|
+
* await generator.install("@react-three/fiber@7")
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
ignore?: string[];
|
|
891
|
+
/**
|
|
892
|
+
* Lockfile data to use for resolutions
|
|
893
|
+
*/
|
|
894
|
+
lock?: LockResolutions;
|
|
895
|
+
/**
|
|
896
|
+
* Support tracing CommonJS dependencies locally. This is necessary if you
|
|
897
|
+
* are using the "nodemodules" provider and have CommonJS dependencies.
|
|
898
|
+
* Disabled by default.
|
|
899
|
+
*/
|
|
900
|
+
commonJS?: boolean;
|
|
901
|
+
/**
|
|
902
|
+
* Support tracing TypeScript dependencies when generating the import map.
|
|
903
|
+
* Disabled by default.
|
|
904
|
+
*/
|
|
905
|
+
typeScript?: boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Support tracing SystemJS dependencies when generating the import map.
|
|
908
|
+
* Disabled by default.
|
|
909
|
+
*/
|
|
910
|
+
system?: boolean;
|
|
911
|
+
/**
|
|
912
|
+
* Whether to include "integrity" field in the import map
|
|
913
|
+
*/
|
|
914
|
+
integrity?: boolean;
|
|
915
|
+
/**
|
|
916
|
+
* Whether to include "dependencyCache" field in the import map.
|
|
917
|
+
* When enabled, the import map will include direct static and dynamic
|
|
918
|
+
* dependencies for each module URL in the final pruned graph.
|
|
919
|
+
*/
|
|
920
|
+
dependencyCache?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* The number of fetch retries to attempt for request failures.
|
|
923
|
+
* Defaults to 3.
|
|
924
|
+
*/
|
|
925
|
+
fetchRetries?: number;
|
|
926
|
+
/**
|
|
927
|
+
* The same as the Node.js `--preserve-symlinks` flag, except it will apply
|
|
928
|
+
* to both the main and the dependencies.
|
|
929
|
+
* See https://nodejs.org/api/cli.html#--preserve-symlinks.
|
|
930
|
+
* This is only supported for file: URLs.
|
|
931
|
+
* Defaults to false, like Node.js.
|
|
932
|
+
*/
|
|
933
|
+
preserveSymlinks?: boolean;
|
|
934
|
+
/**
|
|
935
|
+
* Provider configuration options
|
|
936
|
+
*
|
|
937
|
+
* @example
|
|
938
|
+
* ```js
|
|
939
|
+
* const generator = new Generator({
|
|
940
|
+
* mapUrl: import.meta.url,
|
|
941
|
+
* defaultProvider: "jspm.io",
|
|
942
|
+
* providerConfig: {
|
|
943
|
+
* "jspm.io": {
|
|
944
|
+
* cdnUrl: `https://jspm-mirror.com/`
|
|
945
|
+
* }
|
|
946
|
+
* }
|
|
947
|
+
*/
|
|
948
|
+
providerConfig?: {
|
|
949
|
+
[providerName: string]: any;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Custom async resolver function for intercepting resolution operations.
|
|
953
|
+
*
|
|
954
|
+
* When provided, this function will be called first for all resolution operations.
|
|
955
|
+
* If it returns a string URL, that will be used as the resolved module and persisted
|
|
956
|
+
* in the import map. If it returns undefined, normal resolution continues.
|
|
957
|
+
*
|
|
958
|
+
* @param specifier The module specifier being resolved
|
|
959
|
+
* @param parentUrl The URL of the parent module
|
|
960
|
+
* @param context Additional context including environment and other metadata
|
|
961
|
+
* @returns A resolved URL string or undefined to continue with default resolution
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```js
|
|
965
|
+
* const generator = new Generator({
|
|
966
|
+
* customResolver: async (specifier, parentUrl, context) => {
|
|
967
|
+
* if (specifier === 'my-custom-lib') {
|
|
968
|
+
* return 'https://cdn.example.com/my-custom-lib@1.0.0/index.js';
|
|
969
|
+
* }
|
|
970
|
+
* return undefined;
|
|
971
|
+
* }
|
|
972
|
+
* });
|
|
973
|
+
* ```
|
|
974
|
+
*/
|
|
975
|
+
customResolver?: (specifier: string, parentUrl: string, context: {
|
|
976
|
+
parentPkgUrl: string;
|
|
977
|
+
env?: string[];
|
|
978
|
+
installMode: any;
|
|
979
|
+
toplevel: boolean;
|
|
980
|
+
[key: string]: any;
|
|
981
|
+
}) => string | undefined | Promise<string | undefined>;
|
|
982
|
+
/**
|
|
983
|
+
* @default true
|
|
984
|
+
*
|
|
985
|
+
* Whether to flatten import map scopes into domain-groupings.
|
|
986
|
+
* This is a lossy process, removing scoped dependencies.
|
|
987
|
+
* By default this is done to create a smaller import map output
|
|
988
|
+
* size. Set to false to retain dependency scoping information.
|
|
989
|
+
*
|
|
990
|
+
*/
|
|
991
|
+
flattenScopes?: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* @default true
|
|
994
|
+
*
|
|
995
|
+
* Whether to combine subpaths in the final import map.
|
|
996
|
+
* By default, when possible, the generator will at output time
|
|
997
|
+
* combine similar subpaths in an imports map like:
|
|
998
|
+
*
|
|
999
|
+
* @example
|
|
1000
|
+
* ```json
|
|
1001
|
+
* {
|
|
1002
|
+
* "imports": {
|
|
1003
|
+
* "a/b.js": "./pkg/b.js",
|
|
1004
|
+
* "a/c.js": "./pkg/c.js"
|
|
1005
|
+
* }
|
|
1006
|
+
* }
|
|
1007
|
+
* ```
|
|
1008
|
+
*
|
|
1009
|
+
* Into a single folder mapping:
|
|
1010
|
+
*
|
|
1011
|
+
* ```json
|
|
1012
|
+
* {
|
|
1013
|
+
* "imports": {
|
|
1014
|
+
* "a/": "./pkg/"
|
|
1015
|
+
* }
|
|
1016
|
+
* }
|
|
1017
|
+
* ```
|
|
1018
|
+
*
|
|
1019
|
+
* Resulting in a smaller import map size. This process is done
|
|
1020
|
+
* carefully to never break any existing mappings, but is a lossy
|
|
1021
|
+
* import map compression as well.
|
|
1022
|
+
*
|
|
1023
|
+
* Set this option to false to disable this default behaviour and
|
|
1024
|
+
* retain individual mappings.
|
|
1025
|
+
*
|
|
1026
|
+
* When set to true or 'scopes' (default), only scoped mappings are combined.
|
|
1027
|
+
* When set to 'both', both top-level imports and scoped mappings are combined.
|
|
1028
|
+
* When set to false or 'none', combining is disabled entirely.
|
|
1029
|
+
*/
|
|
1030
|
+
combineSubpaths?: boolean | 'scopes' | 'both' | 'none';
|
|
1031
|
+
/**
|
|
1032
|
+
* Enable trace caching to optimize uncached runs.
|
|
1033
|
+
*
|
|
1034
|
+
* When set to `true`, enables caching of package configs and analysis data
|
|
1035
|
+
* which can be retrieved via `getCache()`.
|
|
1036
|
+
*
|
|
1037
|
+
* When set to a `GeneratorCache` object, restores a previously saved cache
|
|
1038
|
+
* and enables caching for the session.
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```js
|
|
1042
|
+
* // First run - build cache
|
|
1043
|
+
* const gen1 = new Generator({ mapUrl: import.meta.url, traceCache: true });
|
|
1044
|
+
* await gen1.install('react');
|
|
1045
|
+
* const cache = gen1.getCache();
|
|
1046
|
+
* fs.writeFileSync('cache.json', JSON.stringify(cache));
|
|
1047
|
+
*
|
|
1048
|
+
* // Second run - use cache (fast)
|
|
1049
|
+
* const savedCache = JSON.parse(fs.readFileSync('cache.json'));
|
|
1050
|
+
* const gen2 = new Generator({ mapUrl: import.meta.url, traceCache: savedCache });
|
|
1051
|
+
* await gen2.install('react'); // uses cached data, fewer fetches
|
|
1052
|
+
* ```
|
|
1053
|
+
*/
|
|
1054
|
+
traceCache?: GeneratorCache | true;
|
|
1055
|
+
}
|
|
1056
|
+
//#endregion
|
|
1057
|
+
//#region src/plugins/import-map.d.ts
|
|
18
1058
|
interface ImportMapPluginOptions extends GeneratorOptions {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1059
|
+
downloadDeps?: boolean;
|
|
1060
|
+
debug?: boolean;
|
|
1061
|
+
defaultProvider?: 'jspm.io' | 'jsdelivr' | 'unpkg' | 'esm.sh';
|
|
1062
|
+
include?: string[];
|
|
1063
|
+
exclude?: string[];
|
|
24
1064
|
}
|
|
25
|
-
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/plugins/license.d.ts
|
|
26
1067
|
interface LicensePluginOptions {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1068
|
+
name?: string;
|
|
1069
|
+
author?: string;
|
|
1070
|
+
version?: string;
|
|
1071
|
+
description?: string;
|
|
1072
|
+
homepage?: string;
|
|
1073
|
+
license?: string;
|
|
1074
|
+
contact?: string;
|
|
1075
|
+
copyright?: {
|
|
1076
|
+
holder?: string;
|
|
1077
|
+
year?: string | number;
|
|
1078
|
+
};
|
|
38
1079
|
}
|
|
39
|
-
|
|
1080
|
+
//#endregion
|
|
1081
|
+
//#region src/plugins/metadata.d.ts
|
|
40
1082
|
interface MetadataPluginOptions {
|
|
41
|
-
|
|
1083
|
+
extendMetadata?: Record<string, unknown>;
|
|
42
1084
|
}
|
|
43
|
-
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region src/types.d.ts
|
|
44
1087
|
type ProjectType = 'app' | 'lib';
|
|
45
1088
|
interface CommonPluginOptions {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1089
|
+
/**
|
|
1090
|
+
* https://github.com/KusStar/vite-bundle-visualizer
|
|
1091
|
+
* By default template path is: ./node_modules/.cache/visualizer/stats.html
|
|
1092
|
+
*
|
|
1093
|
+
* @default false
|
|
1094
|
+
*/
|
|
1095
|
+
visualizer?: boolean | {
|
|
1096
|
+
help?: boolean;
|
|
1097
|
+
template?: 'treemap' | 'sunburst' | 'network';
|
|
1098
|
+
output?: string;
|
|
1099
|
+
open?: boolean;
|
|
1100
|
+
config?: string;
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Inject license info to output files
|
|
1104
|
+
* Load license file from `package.json`, if it is a monorepo project, the root `package.json` will also be merged
|
|
1105
|
+
*
|
|
1106
|
+
* @default true
|
|
1107
|
+
*/
|
|
1108
|
+
license?: boolean | LicensePluginOptions;
|
|
1109
|
+
/**
|
|
1110
|
+
* https://github.com/originjs/vite-plugin-federation
|
|
1111
|
+
* Module federation
|
|
1112
|
+
*/
|
|
1113
|
+
federation?: VitePluginFederationOptions;
|
|
71
1114
|
}
|
|
72
1115
|
interface AppPluginOptions {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
1116
|
+
/**
|
|
1117
|
+
* https://github.com/chenxch/vite-plugin-dynamic-base
|
|
1118
|
+
* If you want to build once and deploy to multiple environments, you can enable this plugin to set publicPath at runtime
|
|
1119
|
+
* You can set like this: `dynamicBase: 'window.__dynamic_base__'`
|
|
1120
|
+
*/
|
|
1121
|
+
dynamicBase?: string;
|
|
1122
|
+
/**
|
|
1123
|
+
* Inject app loading to `index.html`
|
|
1124
|
+
* You can customize the root element and loading template
|
|
1125
|
+
* Use `[app-loading-title]` as a placeholder to dynamically set the document title during loading`
|
|
1126
|
+
*
|
|
1127
|
+
* @default auto-detect based on `projectType === 'app'`
|
|
1128
|
+
*/
|
|
1129
|
+
appLoading?: boolean | AppLoadingPluginOptions;
|
|
1130
|
+
/**
|
|
1131
|
+
* Injects metadata using `define`, accessible via `__VITE_APP_METADATA__`.
|
|
1132
|
+
* Includes information such as author, build time, version, and more.
|
|
1133
|
+
*
|
|
1134
|
+
* @default auto-detect based on `projectType === 'app'`
|
|
1135
|
+
*/
|
|
1136
|
+
metadata?: boolean | MetadataPluginOptions;
|
|
1137
|
+
/**
|
|
1138
|
+
* Generates an import map for the project.
|
|
1139
|
+
* Based on https://github.com/jspm/vite-plugin-jspm, with extended CDN provider support and options for include/exclude.
|
|
1140
|
+
*
|
|
1141
|
+
* @default false
|
|
1142
|
+
*/
|
|
1143
|
+
importMap?: boolean | ImportMapPluginOptions;
|
|
101
1144
|
}
|
|
102
1145
|
interface LibPluginOptions {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1146
|
+
/**
|
|
1147
|
+
* https://github.com/qmhc/vite-plugin-dts
|
|
1148
|
+
* Generates declaration files from .ts or .vue source files
|
|
1149
|
+
*
|
|
1150
|
+
* @default auto-detect based on `projectType === 'lib'`
|
|
1151
|
+
*/
|
|
1152
|
+
dts?: boolean | PluginOptions;
|
|
110
1153
|
}
|
|
111
1154
|
interface OptionsVue {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
1155
|
+
/**
|
|
1156
|
+
* https://github.com/vuejs/devtools
|
|
1157
|
+
* Enable Vue Devtools
|
|
1158
|
+
*
|
|
1159
|
+
* @default false
|
|
1160
|
+
*/
|
|
1161
|
+
devtools?: boolean | VitePluginVueDevToolsOptions;
|
|
1162
|
+
/**
|
|
1163
|
+
* https://github.com/intlify/bundle-tools
|
|
1164
|
+
* Enable Vue I18n
|
|
1165
|
+
*
|
|
1166
|
+
* @default false
|
|
1167
|
+
*/
|
|
1168
|
+
i18n?: boolean | PluginOptions$1;
|
|
1169
|
+
/**
|
|
1170
|
+
* https://github.com/unplugin/unplugin-auto-import
|
|
1171
|
+
* Auto-imports commonly used APIs such as `vue`, `vue-router`, `pinia`, `@vueuse/core`, etc
|
|
1172
|
+
* Also supports auto-importing UI components from libraries like `ant-design-vue`, `element-plus`, etc
|
|
1173
|
+
* Files from `src/composables` and `src/utils` will also be auto-imported.
|
|
1174
|
+
*
|
|
1175
|
+
* @default auto-detect based on `projectType === 'app'`
|
|
1176
|
+
*/
|
|
1177
|
+
imports?: boolean | Options;
|
|
1178
|
+
/**
|
|
1179
|
+
* https://github.com/unplugin/unplugin-vue-components
|
|
1180
|
+
* Enabled by default when the project type is `app`
|
|
1181
|
+
* The `directoryAsNamespace` option is enabled by default.
|
|
1182
|
+
*
|
|
1183
|
+
* @default auto-detect based on `projectType === 'app'`
|
|
1184
|
+
*/
|
|
1185
|
+
components?: boolean | Options$1;
|
|
1186
|
+
/**
|
|
1187
|
+
* https://github.com/posva/unplugin-vue-router
|
|
1188
|
+
* Enabled by default when the project type is `app`
|
|
1189
|
+
* Folder(s) to scan for files and generate routes. Defaults to scanning the pages directory.
|
|
1190
|
+
*
|
|
1191
|
+
* @default auto-detect based on `projectType === 'app'`
|
|
1192
|
+
*/
|
|
1193
|
+
pages?: boolean | Options$2;
|
|
151
1194
|
}
|
|
152
1195
|
interface OptionsConfig extends CommonPluginOptions, AppPluginOptions, LibPluginOptions {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1196
|
+
/**
|
|
1197
|
+
* Whether to build for production
|
|
1198
|
+
*
|
|
1199
|
+
* @default auto-detect based on `command === 'build'`
|
|
1200
|
+
*/
|
|
1201
|
+
isBuild?: boolean;
|
|
1202
|
+
/**
|
|
1203
|
+
* Type of the project
|
|
1204
|
+
*
|
|
1205
|
+
* @default auto-detect based on the `index.html` file
|
|
1206
|
+
*/
|
|
1207
|
+
type?: ProjectType;
|
|
1208
|
+
/**
|
|
1209
|
+
* Aliases used to replace values in `import` or `require` statements
|
|
1210
|
+
* Paths are automatically resolved if needed
|
|
1211
|
+
*
|
|
1212
|
+
* @default { "@": "./src" }
|
|
1213
|
+
*/
|
|
1214
|
+
alias?: AliasOptions;
|
|
1215
|
+
/**
|
|
1216
|
+
* Enable Vue support
|
|
1217
|
+
* The goal is to provide an automatic registration mechanism similar to Nuxt in app development.
|
|
1218
|
+
*
|
|
1219
|
+
* @default auto-detect based on the dependencies
|
|
1220
|
+
*/
|
|
1221
|
+
vue?: boolean | OptionsVue;
|
|
1222
|
+
/**
|
|
1223
|
+
* Vite configuration override
|
|
1224
|
+
*
|
|
1225
|
+
* @default {}
|
|
1226
|
+
*/
|
|
1227
|
+
vite?: UserConfig;
|
|
185
1228
|
}
|
|
186
1229
|
interface ConditionPlugin {
|
|
187
|
-
|
|
188
|
-
|
|
1230
|
+
condition?: boolean;
|
|
1231
|
+
plugins: () => PluginOption[] | PromiseLike<PluginOption[]>;
|
|
189
1232
|
}
|
|
190
1233
|
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
191
|
-
|
|
1234
|
+
//#endregion
|
|
1235
|
+
//#region src/index.d.ts
|
|
192
1236
|
declare function defineConfig(options: OptionsConfig): vite.UserConfigFnPromise;
|
|
193
|
-
|
|
194
|
-
export { defineConfig };
|
|
195
|
-
export type { AppPluginOptions, CommonPluginOptions, ConditionPlugin, LibPluginOptions, OptionsConfig, OptionsVue, ProjectType, ResolvedOptions };
|
|
1237
|
+
//#endregion
|
|
1238
|
+
export { AppPluginOptions, CommonPluginOptions, ConditionPlugin, LibPluginOptions, OptionsConfig, OptionsVue, ProjectType, ResolvedOptions, defineConfig };
|