kirbyup 0.7.0 → 0.8.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/README.md +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/{cli-default.js → cli.js} +13 -19
- package/dist/index.d.ts +10 -802
- package/dist/index.js +3 -3
- package/package.json +6 -5
- package/dist/cli-default.d.ts +0 -1
- package/dist/cli-main.d.ts +0 -5
- package/dist/cli-main.js +0 -285
- package/dist/types-3e4aea23.d.ts +0 -11
package/README.md
CHANGED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -51,6 +50,15 @@ var init_cjs_shims = __esm({
|
|
|
51
50
|
}
|
|
52
51
|
});
|
|
53
52
|
|
|
53
|
+
// package.json
|
|
54
|
+
var name, version;
|
|
55
|
+
var init_package = __esm({
|
|
56
|
+
"package.json"() {
|
|
57
|
+
name = "kirbyup";
|
|
58
|
+
version = "0.8.0";
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
54
62
|
// src/errors.ts
|
|
55
63
|
function handleError(error) {
|
|
56
64
|
if (error.loc) {
|
|
@@ -91,15 +99,6 @@ var init_errors = __esm({
|
|
|
91
99
|
}
|
|
92
100
|
});
|
|
93
101
|
|
|
94
|
-
// package.json
|
|
95
|
-
var name, version;
|
|
96
|
-
var init_package = __esm({
|
|
97
|
-
"package.json"() {
|
|
98
|
-
name = "kirbyup";
|
|
99
|
-
version = "0.7.0";
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
102
|
// src/utils.ts
|
|
104
103
|
function debouncePromise(fn, delay, onError) {
|
|
105
104
|
let timeout;
|
|
@@ -206,7 +205,7 @@ async function build(_options) {
|
|
|
206
205
|
if (options.watch) {
|
|
207
206
|
log("Running in watch mode");
|
|
208
207
|
}
|
|
209
|
-
const
|
|
208
|
+
const debouncedBuild = debouncePromise(async () => {
|
|
210
209
|
runViteBuild(options);
|
|
211
210
|
}, 100, handleError);
|
|
212
211
|
const startWatcher = async () => {
|
|
@@ -226,7 +225,7 @@ async function build(_options) {
|
|
|
226
225
|
});
|
|
227
226
|
watcher.on("all", async (type, file) => {
|
|
228
227
|
log(`Change detected: ${type} ${file}`);
|
|
229
|
-
|
|
228
|
+
debouncedBuild();
|
|
230
229
|
});
|
|
231
230
|
};
|
|
232
231
|
await runViteBuild(options);
|
|
@@ -256,14 +255,11 @@ var init_src = __esm({
|
|
|
256
255
|
}
|
|
257
256
|
});
|
|
258
257
|
|
|
259
|
-
// src/cli
|
|
260
|
-
init_cjs_shims();
|
|
261
|
-
init_errors();
|
|
262
|
-
|
|
263
|
-
// src/cli-main.ts
|
|
258
|
+
// src/cli.ts
|
|
264
259
|
init_cjs_shims();
|
|
265
260
|
var import_cac = __toModule(require("cac"));
|
|
266
261
|
init_package();
|
|
262
|
+
init_errors();
|
|
267
263
|
async function main(options = {}) {
|
|
268
264
|
const cli = (0, import_cac.cac)(name);
|
|
269
265
|
cli.command("[file]", "Panel input file", {
|
|
@@ -281,6 +277,4 @@ async function main(options = {}) {
|
|
|
281
277
|
cli.parse(process.argv, { run: false });
|
|
282
278
|
await cli.runMatchedCommand();
|
|
283
279
|
}
|
|
284
|
-
|
|
285
|
-
// src/cli-default.ts
|
|
286
280
|
main().catch(handleError);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,807 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
interface RollupWarning extends RollupLogProps {
|
|
10
|
-
chunkName?: string;
|
|
11
|
-
cycle?: string[];
|
|
12
|
-
exportName?: string;
|
|
13
|
-
exporter?: string;
|
|
14
|
-
guess?: string;
|
|
15
|
-
importer?: string;
|
|
16
|
-
missing?: string;
|
|
17
|
-
modules?: string[];
|
|
18
|
-
names?: string[];
|
|
19
|
-
reexporter?: string;
|
|
20
|
-
source?: string;
|
|
21
|
-
sources?: string[];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface RollupLogProps {
|
|
25
|
-
code?: string;
|
|
26
|
-
frame?: string;
|
|
27
|
-
hook?: string;
|
|
28
|
-
id?: string;
|
|
29
|
-
loc?: {
|
|
30
|
-
column: number;
|
|
31
|
-
file?: string;
|
|
32
|
-
line: number;
|
|
33
|
-
};
|
|
34
|
-
message: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
plugin?: string;
|
|
37
|
-
pluginCode?: string;
|
|
38
|
-
pos?: number;
|
|
39
|
-
url?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type SourceMapSegment =
|
|
43
|
-
| [number]
|
|
44
|
-
| [number, number, number, number]
|
|
45
|
-
| [number, number, number, number, number];
|
|
46
|
-
|
|
47
|
-
interface ExistingDecodedSourceMap {
|
|
48
|
-
file?: string;
|
|
49
|
-
mappings: SourceMapSegment[][];
|
|
50
|
-
names: string[];
|
|
51
|
-
sourceRoot?: string;
|
|
52
|
-
sources: string[];
|
|
53
|
-
sourcesContent?: string[];
|
|
54
|
-
version: number;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
interface ExistingRawSourceMap {
|
|
58
|
-
file?: string;
|
|
59
|
-
mappings: string;
|
|
60
|
-
names: string[];
|
|
61
|
-
sourceRoot?: string;
|
|
62
|
-
sources: string[];
|
|
63
|
-
sourcesContent?: string[];
|
|
64
|
-
version: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
type DecodedSourceMapOrMissing =
|
|
68
|
-
| {
|
|
69
|
-
mappings?: never;
|
|
70
|
-
missing: true;
|
|
71
|
-
plugin: string;
|
|
72
|
-
}
|
|
73
|
-
| ExistingDecodedSourceMap;
|
|
74
|
-
|
|
75
|
-
interface SourceMap {
|
|
76
|
-
file: string;
|
|
77
|
-
mappings: string;
|
|
78
|
-
names: string[];
|
|
79
|
-
sources: string[];
|
|
80
|
-
sourcesContent: string[];
|
|
81
|
-
version: number;
|
|
82
|
-
toString(): string;
|
|
83
|
-
toUrl(): string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
|
|
87
|
-
|
|
88
|
-
type PartialNull<T> = {
|
|
89
|
-
[P in keyof T]: T[P] | null;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
interface ModuleOptions {
|
|
93
|
-
meta: CustomPluginOptions;
|
|
94
|
-
moduleSideEffects: boolean | 'no-treeshake';
|
|
95
|
-
syntheticNamedExports: boolean | string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
|
|
99
|
-
ast?: AcornNode;
|
|
100
|
-
code: string;
|
|
101
|
-
map?: SourceMapInput;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
interface TransformModuleJSON extends Partial<PartialNull<ModuleOptions>> {
|
|
105
|
-
ast?: AcornNode;
|
|
106
|
-
code: string;
|
|
107
|
-
// note if plugins use new this.cache to opt-out auto transform cache
|
|
108
|
-
customTransformCache: boolean;
|
|
109
|
-
originalCode: string;
|
|
110
|
-
originalSourcemap: ExistingDecodedSourceMap | null;
|
|
111
|
-
resolvedIds?: ResolvedIdMap;
|
|
112
|
-
sourcemapChain: DecodedSourceMapOrMissing[];
|
|
113
|
-
transformDependencies: string[];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface ModuleJSON extends TransformModuleJSON {
|
|
117
|
-
ast: AcornNode;
|
|
118
|
-
dependencies: string[];
|
|
119
|
-
id: string;
|
|
120
|
-
transformFiles: EmittedFile[] | undefined;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
interface PluginCache {
|
|
124
|
-
delete(id: string): boolean;
|
|
125
|
-
get<T = any>(id: string): T;
|
|
126
|
-
has(id: string): boolean;
|
|
127
|
-
set<T = any>(id: string, value: T): void;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
interface MinimalPluginContext {
|
|
131
|
-
meta: PluginContextMeta;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface EmittedAsset {
|
|
135
|
-
fileName?: string;
|
|
136
|
-
name?: string;
|
|
137
|
-
source?: string | Uint8Array;
|
|
138
|
-
type: 'asset';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
interface EmittedChunk {
|
|
142
|
-
fileName?: string;
|
|
143
|
-
id: string;
|
|
144
|
-
implicitlyLoadedAfterOneOf?: string[];
|
|
145
|
-
importer?: string;
|
|
146
|
-
name?: string;
|
|
147
|
-
preserveSignature?: PreserveEntrySignaturesOption;
|
|
148
|
-
type: 'chunk';
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type EmittedFile = EmittedAsset | EmittedChunk;
|
|
152
|
-
|
|
153
|
-
type EmitAsset = (name: string, source?: string | Uint8Array) => string;
|
|
154
|
-
|
|
155
|
-
type EmitChunk = (id: string, options?: { name?: string }) => string;
|
|
156
|
-
|
|
157
|
-
type EmitFile = (emittedFile: EmittedFile) => string;
|
|
158
|
-
|
|
159
|
-
interface ModuleInfo {
|
|
160
|
-
ast: AcornNode | null;
|
|
161
|
-
code: string | null;
|
|
162
|
-
dynamicImporters: readonly string[];
|
|
163
|
-
dynamicallyImportedIds: readonly string[];
|
|
164
|
-
hasModuleSideEffects: boolean | 'no-treeshake';
|
|
165
|
-
id: string;
|
|
166
|
-
implicitlyLoadedAfterOneOf: readonly string[];
|
|
167
|
-
implicitlyLoadedBefore: readonly string[];
|
|
168
|
-
importedIds: readonly string[];
|
|
169
|
-
importers: readonly string[];
|
|
170
|
-
isEntry: boolean;
|
|
171
|
-
isExternal: boolean;
|
|
172
|
-
meta: CustomPluginOptions;
|
|
173
|
-
syntheticNamedExports: boolean | string;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
|
|
177
|
-
|
|
178
|
-
interface CustomPluginOptions {
|
|
179
|
-
[plugin: string]: any;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
interface PluginContext extends MinimalPluginContext {
|
|
183
|
-
addWatchFile: (id: string) => void;
|
|
184
|
-
cache: PluginCache;
|
|
185
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
186
|
-
emitAsset: EmitAsset;
|
|
187
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
188
|
-
emitChunk: EmitChunk;
|
|
189
|
-
emitFile: EmitFile;
|
|
190
|
-
error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
|
191
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
192
|
-
getAssetFileName: (assetReferenceId: string) => string;
|
|
193
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
194
|
-
getChunkFileName: (chunkReferenceId: string) => string;
|
|
195
|
-
getFileName: (fileReferenceId: string) => string;
|
|
196
|
-
getModuleIds: () => IterableIterator<string>;
|
|
197
|
-
getModuleInfo: GetModuleInfo;
|
|
198
|
-
getWatchFiles: () => string[];
|
|
199
|
-
/** @deprecated Use `this.resolve` instead */
|
|
200
|
-
isExternal: IsExternal;
|
|
201
|
-
/** @deprecated Use `this.getModuleIds` instead */
|
|
202
|
-
moduleIds: IterableIterator<string>;
|
|
203
|
-
parse: (input: string, options?: any) => AcornNode;
|
|
204
|
-
resolve: (
|
|
205
|
-
source: string,
|
|
206
|
-
importer?: string,
|
|
207
|
-
options?: { custom?: CustomPluginOptions; skipSelf?: boolean }
|
|
208
|
-
) => Promise<ResolvedId | null>;
|
|
209
|
-
/** @deprecated Use `this.resolve` instead */
|
|
210
|
-
resolveId: (source: string, importer?: string) => Promise<string | null>;
|
|
211
|
-
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
|
|
212
|
-
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
interface PluginContextMeta {
|
|
216
|
-
rollupVersion: string;
|
|
217
|
-
watchMode: boolean;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
interface ResolvedId extends ModuleOptions {
|
|
221
|
-
external: boolean | 'absolute';
|
|
222
|
-
id: string;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
interface ResolvedIdMap {
|
|
226
|
-
[key: string]: ResolvedId;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
|
|
230
|
-
external?: boolean | 'absolute' | 'relative';
|
|
231
|
-
id: string;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
type ResolveIdResult = string | false | null | undefined | PartialResolvedId;
|
|
235
|
-
|
|
236
|
-
type ResolveIdHook = (
|
|
237
|
-
this: PluginContext,
|
|
238
|
-
source: string,
|
|
239
|
-
importer: string | undefined,
|
|
240
|
-
options: { custom?: CustomPluginOptions }
|
|
241
|
-
) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
242
|
-
|
|
243
|
-
type IsExternal = (
|
|
244
|
-
source: string,
|
|
245
|
-
importer: string | undefined,
|
|
246
|
-
isResolved: boolean
|
|
247
|
-
) => boolean;
|
|
248
|
-
|
|
249
|
-
type IsPureModule = (id: string) => boolean | null | undefined;
|
|
250
|
-
|
|
251
|
-
type HasModuleSideEffects = (id: string, external: boolean) => boolean;
|
|
252
|
-
|
|
253
|
-
type LoadResult = SourceDescription | string | null | undefined;
|
|
254
|
-
|
|
255
|
-
type LoadHook = (this: PluginContext, id: string) => Promise<LoadResult> | LoadResult;
|
|
256
|
-
|
|
257
|
-
interface TransformPluginContext extends PluginContext {
|
|
258
|
-
getCombinedSourcemap: () => SourceMap;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
type TransformResult = string | null | undefined | Partial<SourceDescription>;
|
|
262
|
-
|
|
263
|
-
type TransformHook = (
|
|
264
|
-
this: TransformPluginContext,
|
|
265
|
-
code: string,
|
|
266
|
-
id: string
|
|
267
|
-
) => Promise<TransformResult> | TransformResult;
|
|
268
|
-
|
|
269
|
-
type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => Promise<void> | void;
|
|
270
|
-
|
|
271
|
-
type RenderChunkHook = (
|
|
272
|
-
this: PluginContext,
|
|
273
|
-
code: string,
|
|
274
|
-
chunk: RenderedChunk,
|
|
275
|
-
options: NormalizedOutputOptions
|
|
276
|
-
) =>
|
|
277
|
-
| Promise<{ code: string; map?: SourceMapInput } | null>
|
|
278
|
-
| { code: string; map?: SourceMapInput }
|
|
279
|
-
| string
|
|
280
|
-
| null
|
|
281
|
-
| undefined;
|
|
282
|
-
|
|
283
|
-
type ResolveDynamicImportHook = (
|
|
284
|
-
this: PluginContext,
|
|
285
|
-
specifier: string | AcornNode,
|
|
286
|
-
importer: string
|
|
287
|
-
) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
288
|
-
|
|
289
|
-
type ResolveImportMetaHook = (
|
|
290
|
-
this: PluginContext,
|
|
291
|
-
prop: string | null,
|
|
292
|
-
options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
|
|
293
|
-
) => string | null | undefined;
|
|
294
|
-
|
|
295
|
-
type ResolveAssetUrlHook = (
|
|
296
|
-
this: PluginContext,
|
|
297
|
-
options: {
|
|
298
|
-
assetFileName: string;
|
|
299
|
-
chunkId: string;
|
|
300
|
-
format: InternalModuleFormat;
|
|
301
|
-
moduleId: string;
|
|
302
|
-
relativeAssetPath: string;
|
|
303
|
-
}
|
|
304
|
-
) => string | null | undefined;
|
|
305
|
-
|
|
306
|
-
type ResolveFileUrlHook = (
|
|
307
|
-
this: PluginContext,
|
|
308
|
-
options: {
|
|
309
|
-
assetReferenceId: string | null;
|
|
310
|
-
chunkId: string;
|
|
311
|
-
chunkReferenceId: string | null;
|
|
312
|
-
fileName: string;
|
|
313
|
-
format: InternalModuleFormat;
|
|
314
|
-
moduleId: string;
|
|
315
|
-
referenceId: string;
|
|
316
|
-
relativePath: string;
|
|
317
|
-
}
|
|
318
|
-
) => string | null | undefined;
|
|
319
|
-
|
|
320
|
-
type AddonHookFunction = (this: PluginContext) => string | Promise<string>;
|
|
321
|
-
type AddonHook = string | AddonHookFunction;
|
|
322
|
-
|
|
323
|
-
type ChangeEvent = 'create' | 'update' | 'delete';
|
|
324
|
-
type WatchChangeHook = (
|
|
325
|
-
this: PluginContext,
|
|
326
|
-
id: string,
|
|
327
|
-
change: { event: ChangeEvent }
|
|
328
|
-
) => void;
|
|
329
|
-
|
|
330
|
-
interface OutputBundle {
|
|
331
|
-
[fileName: string]: OutputAsset | OutputChunk;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
interface PluginHooks extends OutputPluginHooks {
|
|
335
|
-
buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
|
|
336
|
-
buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
|
|
337
|
-
closeBundle: (this: PluginContext) => Promise<void> | void;
|
|
338
|
-
closeWatcher: (this: PluginContext) => void;
|
|
339
|
-
load: LoadHook;
|
|
340
|
-
moduleParsed: ModuleParsedHook;
|
|
341
|
-
options: (
|
|
342
|
-
this: MinimalPluginContext,
|
|
343
|
-
options: InputOptions
|
|
344
|
-
) => Promise<InputOptions | null | undefined> | InputOptions | null | undefined;
|
|
345
|
-
resolveDynamicImport: ResolveDynamicImportHook;
|
|
346
|
-
resolveId: ResolveIdHook;
|
|
347
|
-
transform: TransformHook;
|
|
348
|
-
watchChange: WatchChangeHook;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
interface OutputPluginHooks {
|
|
352
|
-
augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void;
|
|
353
|
-
generateBundle: (
|
|
354
|
-
this: PluginContext,
|
|
355
|
-
options: NormalizedOutputOptions,
|
|
356
|
-
bundle: OutputBundle,
|
|
357
|
-
isWrite: boolean
|
|
358
|
-
) => void | Promise<void>;
|
|
359
|
-
outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | undefined;
|
|
360
|
-
renderChunk: RenderChunkHook;
|
|
361
|
-
renderDynamicImport: (
|
|
362
|
-
this: PluginContext,
|
|
363
|
-
options: {
|
|
364
|
-
customResolution: string | null;
|
|
365
|
-
format: InternalModuleFormat;
|
|
366
|
-
moduleId: string;
|
|
367
|
-
targetModuleId: string | null;
|
|
368
|
-
}
|
|
369
|
-
) => { left: string; right: string } | null | undefined;
|
|
370
|
-
renderError: (this: PluginContext, err?: Error) => Promise<void> | void;
|
|
371
|
-
renderStart: (
|
|
372
|
-
this: PluginContext,
|
|
373
|
-
outputOptions: NormalizedOutputOptions,
|
|
374
|
-
inputOptions: NormalizedInputOptions
|
|
375
|
-
) => Promise<void> | void;
|
|
376
|
-
/** @deprecated Use `resolveFileUrl` instead */
|
|
377
|
-
resolveAssetUrl: ResolveAssetUrlHook;
|
|
378
|
-
resolveFileUrl: ResolveFileUrlHook;
|
|
379
|
-
resolveImportMeta: ResolveImportMetaHook;
|
|
380
|
-
writeBundle: (
|
|
381
|
-
this: PluginContext,
|
|
382
|
-
options: NormalizedOutputOptions,
|
|
383
|
-
bundle: OutputBundle
|
|
384
|
-
) => void | Promise<void>;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
interface OutputPluginValueHooks {
|
|
388
|
-
banner: AddonHook;
|
|
389
|
-
cacheKey: string;
|
|
390
|
-
footer: AddonHook;
|
|
391
|
-
intro: AddonHook;
|
|
392
|
-
outro: AddonHook;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
interface Plugin extends Partial<PluginHooks>, Partial<OutputPluginValueHooks> {
|
|
396
|
-
// for inter-plugin communication
|
|
397
|
-
api?: any;
|
|
398
|
-
name: string;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
interface OutputPlugin extends Partial<OutputPluginHooks>, Partial<OutputPluginValueHooks> {
|
|
402
|
-
name: string;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
|
|
406
|
-
|
|
407
|
-
interface TreeshakingOptions {
|
|
408
|
-
annotations?: boolean;
|
|
409
|
-
correctVarValueBeforeDeclaration?: boolean;
|
|
410
|
-
moduleSideEffects?: ModuleSideEffectsOption;
|
|
411
|
-
preset?: TreeshakingPreset;
|
|
412
|
-
propertyReadSideEffects?: boolean | 'always';
|
|
413
|
-
/** @deprecated Use `moduleSideEffects` instead */
|
|
414
|
-
pureExternalModules?: PureModulesOption;
|
|
415
|
-
tryCatchDeoptimization?: boolean;
|
|
416
|
-
unknownGlobalSideEffects?: boolean;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
interface NormalizedTreeshakingOptions {
|
|
420
|
-
annotations: boolean;
|
|
421
|
-
correctVarValueBeforeDeclaration: boolean;
|
|
422
|
-
moduleSideEffects: HasModuleSideEffects;
|
|
423
|
-
propertyReadSideEffects: boolean | 'always';
|
|
424
|
-
tryCatchDeoptimization: boolean;
|
|
425
|
-
unknownGlobalSideEffects: boolean;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
interface GetManualChunkApi {
|
|
429
|
-
getModuleIds: () => IterableIterator<string>;
|
|
430
|
-
getModuleInfo: GetModuleInfo;
|
|
431
|
-
}
|
|
432
|
-
type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | undefined;
|
|
433
|
-
|
|
434
|
-
type ExternalOption =
|
|
435
|
-
| (string | RegExp)[]
|
|
436
|
-
| string
|
|
437
|
-
| RegExp
|
|
438
|
-
| ((
|
|
439
|
-
source: string,
|
|
440
|
-
importer: string | undefined,
|
|
441
|
-
isResolved: boolean
|
|
442
|
-
) => boolean | null | undefined);
|
|
443
|
-
type PureModulesOption = boolean | string[] | IsPureModule;
|
|
444
|
-
type GlobalsOption = { [name: string]: string } | ((name: string) => string);
|
|
445
|
-
type InputOption = string | string[] | { [entryAlias: string]: string };
|
|
446
|
-
type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk;
|
|
447
|
-
type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;
|
|
448
|
-
type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
|
|
449
|
-
type SourcemapPathTransformOption = (
|
|
450
|
-
relativeSourcePath: string,
|
|
451
|
-
sourcemapPath: string
|
|
452
|
-
) => string;
|
|
453
|
-
|
|
454
|
-
interface InputOptions {
|
|
455
|
-
acorn?: Record<string, unknown>;
|
|
456
|
-
acornInjectPlugins?: (() => unknown)[] | (() => unknown);
|
|
457
|
-
cache?: false | RollupCache;
|
|
458
|
-
context?: string;
|
|
459
|
-
experimentalCacheExpiry?: number;
|
|
460
|
-
external?: ExternalOption;
|
|
461
|
-
/** @deprecated Use the "inlineDynamicImports" output option instead. */
|
|
462
|
-
inlineDynamicImports?: boolean;
|
|
463
|
-
input?: InputOption;
|
|
464
|
-
makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
|
|
465
|
-
/** @deprecated Use the "manualChunks" output option instead. */
|
|
466
|
-
manualChunks?: ManualChunksOption;
|
|
467
|
-
maxParallelFileReads?: number;
|
|
468
|
-
moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
|
|
469
|
-
onwarn?: WarningHandlerWithDefault;
|
|
470
|
-
perf?: boolean;
|
|
471
|
-
plugins?: (Plugin | null | false | undefined)[];
|
|
472
|
-
preserveEntrySignatures?: PreserveEntrySignaturesOption;
|
|
473
|
-
/** @deprecated Use the "preserveModules" output option instead. */
|
|
474
|
-
preserveModules?: boolean;
|
|
475
|
-
preserveSymlinks?: boolean;
|
|
476
|
-
shimMissingExports?: boolean;
|
|
477
|
-
strictDeprecations?: boolean;
|
|
478
|
-
treeshake?: boolean | TreeshakingPreset | TreeshakingOptions;
|
|
479
|
-
watch?: WatcherOptions | false;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
interface NormalizedInputOptions {
|
|
483
|
-
acorn: Record<string, unknown>;
|
|
484
|
-
acornInjectPlugins: (() => unknown)[];
|
|
485
|
-
cache: false | undefined | RollupCache;
|
|
486
|
-
context: string;
|
|
487
|
-
experimentalCacheExpiry: number;
|
|
488
|
-
external: IsExternal;
|
|
489
|
-
/** @deprecated Use the "inlineDynamicImports" output option instead. */
|
|
490
|
-
inlineDynamicImports: boolean | undefined;
|
|
491
|
-
input: string[] | { [entryAlias: string]: string };
|
|
492
|
-
makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
|
|
493
|
-
/** @deprecated Use the "manualChunks" output option instead. */
|
|
494
|
-
manualChunks: ManualChunksOption | undefined;
|
|
495
|
-
maxParallelFileReads: number;
|
|
496
|
-
moduleContext: (id: string) => string;
|
|
497
|
-
onwarn: WarningHandler;
|
|
498
|
-
perf: boolean;
|
|
499
|
-
plugins: Plugin[];
|
|
500
|
-
preserveEntrySignatures: PreserveEntrySignaturesOption;
|
|
501
|
-
/** @deprecated Use the "preserveModules" output option instead. */
|
|
502
|
-
preserveModules: boolean | undefined;
|
|
503
|
-
preserveSymlinks: boolean;
|
|
504
|
-
shimMissingExports: boolean;
|
|
505
|
-
strictDeprecations: boolean;
|
|
506
|
-
treeshake: false | NormalizedTreeshakingOptions;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd';
|
|
510
|
-
|
|
511
|
-
type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs';
|
|
512
|
-
|
|
513
|
-
type OptionsPaths = Record<string, string> | ((id: string) => string);
|
|
514
|
-
|
|
515
|
-
type InteropType = boolean | 'auto' | 'esModule' | 'default' | 'defaultOnly';
|
|
516
|
-
|
|
517
|
-
type GetInterop = (id: string | null) => InteropType;
|
|
518
|
-
|
|
519
|
-
type AmdOptions = (
|
|
520
|
-
| {
|
|
521
|
-
autoId?: false;
|
|
522
|
-
id: string;
|
|
523
|
-
}
|
|
524
|
-
| {
|
|
525
|
-
autoId: true;
|
|
526
|
-
basePath?: string;
|
|
527
|
-
id?: undefined;
|
|
528
|
-
}
|
|
529
|
-
| {
|
|
530
|
-
autoId?: false;
|
|
531
|
-
id?: undefined;
|
|
532
|
-
}
|
|
533
|
-
) & {
|
|
534
|
-
define?: string;
|
|
1
|
+
import * as rollup from 'rollup';
|
|
2
|
+
import { MarkRequired } from 'ts-essentials';
|
|
3
|
+
|
|
4
|
+
/** Array, or not yet an array */
|
|
5
|
+
declare type Arrayable<T> = T | Array<T>;
|
|
6
|
+
declare type Options = {
|
|
7
|
+
entry?: string;
|
|
8
|
+
watch?: Arrayable<boolean | string>;
|
|
535
9
|
};
|
|
10
|
+
declare type NormalizedOptions = MarkRequired<Options, 'entry'>;
|
|
536
11
|
|
|
537
|
-
|
|
538
|
-
| {
|
|
539
|
-
autoId: false;
|
|
540
|
-
id?: string;
|
|
541
|
-
}
|
|
542
|
-
| {
|
|
543
|
-
autoId: true;
|
|
544
|
-
basePath: string;
|
|
545
|
-
}
|
|
546
|
-
) & {
|
|
547
|
-
define: string;
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
interface OutputOptions {
|
|
551
|
-
amd?: AmdOptions;
|
|
552
|
-
assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
|
|
553
|
-
banner?: string | (() => string | Promise<string>);
|
|
554
|
-
chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
|
|
555
|
-
compact?: boolean;
|
|
556
|
-
// only required for bundle.write
|
|
557
|
-
dir?: string;
|
|
558
|
-
/** @deprecated Use the "renderDynamicImport" plugin hook instead. */
|
|
559
|
-
dynamicImportFunction?: string;
|
|
560
|
-
entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
|
|
561
|
-
esModule?: boolean;
|
|
562
|
-
exports?: 'default' | 'named' | 'none' | 'auto';
|
|
563
|
-
extend?: boolean;
|
|
564
|
-
externalLiveBindings?: boolean;
|
|
565
|
-
// only required for bundle.write
|
|
566
|
-
file?: string;
|
|
567
|
-
footer?: string | (() => string | Promise<string>);
|
|
568
|
-
format?: ModuleFormat;
|
|
569
|
-
freeze?: boolean;
|
|
570
|
-
globals?: GlobalsOption;
|
|
571
|
-
hoistTransitiveImports?: boolean;
|
|
572
|
-
indent?: string | boolean;
|
|
573
|
-
inlineDynamicImports?: boolean;
|
|
574
|
-
interop?: InteropType | GetInterop;
|
|
575
|
-
intro?: string | (() => string | Promise<string>);
|
|
576
|
-
manualChunks?: ManualChunksOption;
|
|
577
|
-
minifyInternalExports?: boolean;
|
|
578
|
-
name?: string;
|
|
579
|
-
namespaceToStringTag?: boolean;
|
|
580
|
-
noConflict?: boolean;
|
|
581
|
-
outro?: string | (() => string | Promise<string>);
|
|
582
|
-
paths?: OptionsPaths;
|
|
583
|
-
plugins?: (OutputPlugin | null | false | undefined)[];
|
|
584
|
-
preferConst?: boolean;
|
|
585
|
-
preserveModules?: boolean;
|
|
586
|
-
preserveModulesRoot?: string;
|
|
587
|
-
sanitizeFileName?: boolean | ((fileName: string) => string);
|
|
588
|
-
sourcemap?: boolean | 'inline' | 'hidden';
|
|
589
|
-
sourcemapExcludeSources?: boolean;
|
|
590
|
-
sourcemapFile?: string;
|
|
591
|
-
sourcemapPathTransform?: SourcemapPathTransformOption;
|
|
592
|
-
strict?: boolean;
|
|
593
|
-
systemNullSetters?: boolean;
|
|
594
|
-
validate?: boolean;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
interface NormalizedOutputOptions {
|
|
598
|
-
amd: NormalizedAmdOptions;
|
|
599
|
-
assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string);
|
|
600
|
-
banner: () => string | Promise<string>;
|
|
601
|
-
chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
|
|
602
|
-
compact: boolean;
|
|
603
|
-
dir: string | undefined;
|
|
604
|
-
/** @deprecated Use the "renderDynamicImport" plugin hook instead. */
|
|
605
|
-
dynamicImportFunction: string | undefined;
|
|
606
|
-
entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
|
|
607
|
-
esModule: boolean;
|
|
608
|
-
exports: 'default' | 'named' | 'none' | 'auto';
|
|
609
|
-
extend: boolean;
|
|
610
|
-
externalLiveBindings: boolean;
|
|
611
|
-
file: string | undefined;
|
|
612
|
-
footer: () => string | Promise<string>;
|
|
613
|
-
format: InternalModuleFormat;
|
|
614
|
-
freeze: boolean;
|
|
615
|
-
globals: GlobalsOption;
|
|
616
|
-
hoistTransitiveImports: boolean;
|
|
617
|
-
indent: true | string;
|
|
618
|
-
inlineDynamicImports: boolean;
|
|
619
|
-
interop: GetInterop;
|
|
620
|
-
intro: () => string | Promise<string>;
|
|
621
|
-
manualChunks: ManualChunksOption;
|
|
622
|
-
minifyInternalExports: boolean;
|
|
623
|
-
name: string | undefined;
|
|
624
|
-
namespaceToStringTag: boolean;
|
|
625
|
-
noConflict: boolean;
|
|
626
|
-
outro: () => string | Promise<string>;
|
|
627
|
-
paths: OptionsPaths;
|
|
628
|
-
plugins: OutputPlugin[];
|
|
629
|
-
preferConst: boolean;
|
|
630
|
-
preserveModules: boolean;
|
|
631
|
-
preserveModulesRoot: string | undefined;
|
|
632
|
-
sanitizeFileName: (fileName: string) => string;
|
|
633
|
-
sourcemap: boolean | 'inline' | 'hidden';
|
|
634
|
-
sourcemapExcludeSources: boolean;
|
|
635
|
-
sourcemapFile: string | undefined;
|
|
636
|
-
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
|
637
|
-
strict: boolean;
|
|
638
|
-
systemNullSetters: boolean;
|
|
639
|
-
validate: boolean;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
type WarningHandlerWithDefault = (
|
|
643
|
-
warning: RollupWarning,
|
|
644
|
-
defaultHandler: WarningHandler
|
|
645
|
-
) => void;
|
|
646
|
-
type WarningHandler = (warning: RollupWarning) => void;
|
|
647
|
-
|
|
648
|
-
interface SerializedTimings {
|
|
649
|
-
[label: string]: [number, number, number];
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
interface PreRenderedAsset {
|
|
653
|
-
name: string | undefined;
|
|
654
|
-
source: string | Uint8Array;
|
|
655
|
-
type: 'asset';
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
interface OutputAsset extends PreRenderedAsset {
|
|
659
|
-
fileName: string;
|
|
660
|
-
/** @deprecated Accessing "isAsset" on files in the bundle is deprecated, please use "type === \'asset\'" instead */
|
|
661
|
-
isAsset: true;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
interface RenderedModule {
|
|
665
|
-
code: string | null;
|
|
666
|
-
originalLength: number;
|
|
667
|
-
removedExports: string[];
|
|
668
|
-
renderedExports: string[];
|
|
669
|
-
renderedLength: number;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
interface PreRenderedChunk {
|
|
673
|
-
exports: string[];
|
|
674
|
-
facadeModuleId: string | null;
|
|
675
|
-
isDynamicEntry: boolean;
|
|
676
|
-
isEntry: boolean;
|
|
677
|
-
isImplicitEntry: boolean;
|
|
678
|
-
modules: {
|
|
679
|
-
[id: string]: RenderedModule;
|
|
680
|
-
};
|
|
681
|
-
name: string;
|
|
682
|
-
type: 'chunk';
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
interface RenderedChunk extends PreRenderedChunk {
|
|
686
|
-
code?: string;
|
|
687
|
-
dynamicImports: string[];
|
|
688
|
-
fileName: string;
|
|
689
|
-
implicitlyLoadedBefore: string[];
|
|
690
|
-
importedBindings: {
|
|
691
|
-
[imported: string]: string[];
|
|
692
|
-
};
|
|
693
|
-
imports: string[];
|
|
694
|
-
map?: SourceMap;
|
|
695
|
-
referencedFiles: string[];
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
interface OutputChunk extends RenderedChunk {
|
|
699
|
-
code: string;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
interface SerializablePluginCache {
|
|
703
|
-
[key: string]: [number, any];
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
interface RollupCache {
|
|
707
|
-
modules: ModuleJSON[];
|
|
708
|
-
plugins?: Record<string, SerializablePluginCache>;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
interface RollupOutput {
|
|
712
|
-
output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
interface RollupBuild {
|
|
716
|
-
cache: RollupCache | undefined;
|
|
717
|
-
close: () => Promise<void>;
|
|
718
|
-
closed: boolean;
|
|
719
|
-
generate: (outputOptions: OutputOptions) => Promise<RollupOutput>;
|
|
720
|
-
getTimings?: () => SerializedTimings;
|
|
721
|
-
watchFiles: string[];
|
|
722
|
-
write: (options: OutputOptions) => Promise<RollupOutput>;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
interface ChokidarOptions {
|
|
726
|
-
alwaysStat?: boolean;
|
|
727
|
-
atomic?: boolean | number;
|
|
728
|
-
awaitWriteFinish?:
|
|
729
|
-
| {
|
|
730
|
-
pollInterval?: number;
|
|
731
|
-
stabilityThreshold?: number;
|
|
732
|
-
}
|
|
733
|
-
| boolean;
|
|
734
|
-
binaryInterval?: number;
|
|
735
|
-
cwd?: string;
|
|
736
|
-
depth?: number;
|
|
737
|
-
disableGlobbing?: boolean;
|
|
738
|
-
followSymlinks?: boolean;
|
|
739
|
-
ignoreInitial?: boolean;
|
|
740
|
-
ignorePermissionErrors?: boolean;
|
|
741
|
-
ignored?: any;
|
|
742
|
-
interval?: number;
|
|
743
|
-
persistent?: boolean;
|
|
744
|
-
useFsEvents?: boolean;
|
|
745
|
-
usePolling?: boolean;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
interface WatcherOptions {
|
|
749
|
-
buildDelay?: number;
|
|
750
|
-
chokidar?: ChokidarOptions;
|
|
751
|
-
clearScreen?: boolean;
|
|
752
|
-
exclude?: string | RegExp | (string | RegExp)[];
|
|
753
|
-
include?: string | RegExp | (string | RegExp)[];
|
|
754
|
-
skipWrite?: boolean;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }> {
|
|
758
|
-
addListener<K extends keyof T>(event: K, listener: T[K]): this;
|
|
759
|
-
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): boolean;
|
|
760
|
-
eventNames(): Array<keyof T>;
|
|
761
|
-
getMaxListeners(): number;
|
|
762
|
-
listenerCount(type: keyof T): number;
|
|
763
|
-
listeners<K extends keyof T>(event: K): Array<T[K]>;
|
|
764
|
-
off<K extends keyof T>(event: K, listener: T[K]): this;
|
|
765
|
-
on<K extends keyof T>(event: K, listener: T[K]): this;
|
|
766
|
-
once<K extends keyof T>(event: K, listener: T[K]): this;
|
|
767
|
-
prependListener<K extends keyof T>(event: K, listener: T[K]): this;
|
|
768
|
-
prependOnceListener<K extends keyof T>(event: K, listener: T[K]): this;
|
|
769
|
-
rawListeners<K extends keyof T>(event: K): Array<T[K]>;
|
|
770
|
-
removeAllListeners<K extends keyof T>(event?: K): this;
|
|
771
|
-
removeListener<K extends keyof T>(event: K, listener: T[K]): this;
|
|
772
|
-
setMaxListeners(n: number): this;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
type RollupWatcherEvent =
|
|
776
|
-
| { code: 'START' }
|
|
777
|
-
| { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] }
|
|
778
|
-
| {
|
|
779
|
-
code: 'BUNDLE_END';
|
|
780
|
-
duration: number;
|
|
781
|
-
input?: InputOption;
|
|
782
|
-
output: readonly string[];
|
|
783
|
-
result: RollupBuild;
|
|
784
|
-
}
|
|
785
|
-
| { code: 'END' }
|
|
786
|
-
| { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
|
|
787
|
-
|
|
788
|
-
interface RollupWatcher
|
|
789
|
-
extends TypedEventEmitter<{
|
|
790
|
-
change: (id: string, change: { event: ChangeEvent }) => void;
|
|
791
|
-
close: () => void;
|
|
792
|
-
event: (event: RollupWatcherEvent) => void;
|
|
793
|
-
restart: () => void;
|
|
794
|
-
}> {
|
|
795
|
-
close(): void;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
interface AcornNode {
|
|
799
|
-
end: number;
|
|
800
|
-
start: number;
|
|
801
|
-
type: string;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
declare function runViteBuild(options: NormalizedOptions): Promise<Arrayable<RollupOutput> | RollupWatcher>;
|
|
12
|
+
declare function runViteBuild(options: NormalizedOptions): Promise<rollup.RollupOutput | rollup.RollupOutput[] | rollup.RollupWatcher>;
|
|
805
13
|
declare function build(_options: Options): Promise<void>;
|
|
806
14
|
|
|
807
15
|
export { build, runViteBuild };
|
package/dist/index.js
CHANGED
|
@@ -105,7 +105,7 @@ var import_chalk2 = __toModule(require("chalk"));
|
|
|
105
105
|
|
|
106
106
|
// package.json
|
|
107
107
|
var name = "kirbyup";
|
|
108
|
-
var version = "0.
|
|
108
|
+
var version = "0.8.0";
|
|
109
109
|
|
|
110
110
|
// src/log.ts
|
|
111
111
|
var colorMap = new Map([
|
|
@@ -178,7 +178,7 @@ async function build(_options) {
|
|
|
178
178
|
if (options.watch) {
|
|
179
179
|
log("Running in watch mode");
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const debouncedBuild = debouncePromise(async () => {
|
|
182
182
|
runViteBuild(options);
|
|
183
183
|
}, 100, handleError);
|
|
184
184
|
const startWatcher = async () => {
|
|
@@ -198,7 +198,7 @@ async function build(_options) {
|
|
|
198
198
|
});
|
|
199
199
|
watcher.on("all", async (type, file) => {
|
|
200
200
|
log(`Change detected: ${type} ${file}`);
|
|
201
|
-
|
|
201
|
+
debouncedBuild();
|
|
202
202
|
});
|
|
203
203
|
};
|
|
204
204
|
await runViteBuild(options);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirbyup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Zero-config bundler for Kirby Panel plugins",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"bin": {
|
|
10
|
-
"kirbyup": "dist/cli
|
|
10
|
+
"kirbyup": "dist/cli.js"
|
|
11
11
|
},
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/johannschopplich/kirbyup#readme",
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsup src/cli
|
|
35
|
+
"build": "tsup src/cli.ts src/index.ts --target node14 --clean --dts",
|
|
36
36
|
"prepublishOnly": "npm run build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
@@ -40,13 +40,14 @@
|
|
|
40
40
|
"chalk": "^4.1.2",
|
|
41
41
|
"chokidar": "^3.5.2",
|
|
42
42
|
"sass": "^1.41.1",
|
|
43
|
-
"vite": "^2.5.
|
|
43
|
+
"vite": "^2.5.10",
|
|
44
44
|
"vite-plugin-vue2": "^1.8.2",
|
|
45
45
|
"vue": "^2.6.14"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^16.9.
|
|
48
|
+
"@types/node": "^16.9.4",
|
|
49
49
|
"prettier": "^2.4.1",
|
|
50
|
+
"ts-essentials": "^8.1.0",
|
|
50
51
|
"tsup": "^5.1.0",
|
|
51
52
|
"typescript": "^4.4.3"
|
|
52
53
|
}
|
package/dist/cli-default.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
package/dist/cli-main.d.ts
DELETED
package/dist/cli-main.js
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
-
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
23
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
24
|
-
};
|
|
25
|
-
var __esm = (fn, res) => function __init() {
|
|
26
|
-
return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
|
|
27
|
-
};
|
|
28
|
-
var __export = (target, all) => {
|
|
29
|
-
__markAsModule(target);
|
|
30
|
-
for (var name2 in all)
|
|
31
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
32
|
-
};
|
|
33
|
-
var __reExport = (target, module2, desc) => {
|
|
34
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
35
|
-
for (let key of __getOwnPropNames(module2))
|
|
36
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
37
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
38
|
-
}
|
|
39
|
-
return target;
|
|
40
|
-
};
|
|
41
|
-
var __toModule = (module2) => {
|
|
42
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// node_modules/tsup/assets/cjs_shims.js
|
|
46
|
-
var importMetaUrlShim;
|
|
47
|
-
var init_cjs_shims = __esm({
|
|
48
|
-
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
49
|
-
importMetaUrlShim = typeof document === "undefined" ? new (require("url")).URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// package.json
|
|
54
|
-
var name, version;
|
|
55
|
-
var init_package = __esm({
|
|
56
|
-
"package.json"() {
|
|
57
|
-
name = "kirbyup";
|
|
58
|
-
version = "0.7.0";
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// src/errors.ts
|
|
63
|
-
function handleError(error) {
|
|
64
|
-
if (error.loc) {
|
|
65
|
-
console.error(import_chalk.default.bold(import_chalk.default.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)));
|
|
66
|
-
}
|
|
67
|
-
if (error.frame) {
|
|
68
|
-
console.error(import_chalk.default.red(error.message));
|
|
69
|
-
console.error(import_chalk.default.dim(error.frame));
|
|
70
|
-
} else {
|
|
71
|
-
if (error instanceof PrettyError) {
|
|
72
|
-
console.error(import_chalk.default.red(error.message));
|
|
73
|
-
} else {
|
|
74
|
-
console.error(import_chalk.default.red(error.stack));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
process.exitCode = 1;
|
|
78
|
-
if (!import_worker_threads.isMainThread && import_worker_threads.parentPort) {
|
|
79
|
-
import_worker_threads.parentPort.postMessage("has-error");
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
var import_worker_threads, import_chalk, PrettyError;
|
|
83
|
-
var init_errors = __esm({
|
|
84
|
-
"src/errors.ts"() {
|
|
85
|
-
init_cjs_shims();
|
|
86
|
-
import_worker_threads = __toModule(require("worker_threads"));
|
|
87
|
-
import_chalk = __toModule(require("chalk"));
|
|
88
|
-
PrettyError = class extends Error {
|
|
89
|
-
constructor(message) {
|
|
90
|
-
super(message);
|
|
91
|
-
this.name = this.constructor.name;
|
|
92
|
-
if (typeof Error.captureStackTrace === "function") {
|
|
93
|
-
Error.captureStackTrace(this, this.constructor);
|
|
94
|
-
} else {
|
|
95
|
-
this.stack = new Error(message).stack;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// src/utils.ts
|
|
103
|
-
function debouncePromise(fn, delay, onError) {
|
|
104
|
-
let timeout;
|
|
105
|
-
let promiseInFly;
|
|
106
|
-
let callbackPending;
|
|
107
|
-
return function debounced(...args) {
|
|
108
|
-
if (promiseInFly) {
|
|
109
|
-
callbackPending = () => {
|
|
110
|
-
debounced(...args);
|
|
111
|
-
callbackPending = void 0;
|
|
112
|
-
};
|
|
113
|
-
} else {
|
|
114
|
-
if (timeout != null)
|
|
115
|
-
clearTimeout(timeout);
|
|
116
|
-
timeout = setTimeout(() => {
|
|
117
|
-
timeout = void 0;
|
|
118
|
-
promiseInFly = fn(...args).catch(onError).finally(() => {
|
|
119
|
-
promiseInFly = void 0;
|
|
120
|
-
if (callbackPending)
|
|
121
|
-
callbackPending();
|
|
122
|
-
});
|
|
123
|
-
}, delay);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
var init_utils = __esm({
|
|
128
|
-
"src/utils.ts"() {
|
|
129
|
-
init_cjs_shims();
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// src/log.ts
|
|
134
|
-
function log(message, type = "info") {
|
|
135
|
-
var _a;
|
|
136
|
-
const content = [
|
|
137
|
-
import_chalk2.default.gray(`[${name}]`),
|
|
138
|
-
import_chalk2.default[(_a = colorMap.get(type)) != null ? _a : "white"](message)
|
|
139
|
-
];
|
|
140
|
-
if (type === "error") {
|
|
141
|
-
console.error(...content);
|
|
142
|
-
} else {
|
|
143
|
-
console.log(...content);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
var import_chalk2, colorMap;
|
|
147
|
-
var init_log = __esm({
|
|
148
|
-
"src/log.ts"() {
|
|
149
|
-
init_cjs_shims();
|
|
150
|
-
import_chalk2 = __toModule(require("chalk"));
|
|
151
|
-
init_package();
|
|
152
|
-
colorMap = new Map([
|
|
153
|
-
["info", "yellow"],
|
|
154
|
-
["success", "green"],
|
|
155
|
-
["error", "red"]
|
|
156
|
-
]);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// src/index.ts
|
|
161
|
-
var src_exports = {};
|
|
162
|
-
__export(src_exports, {
|
|
163
|
-
build: () => build,
|
|
164
|
-
runViteBuild: () => runViteBuild
|
|
165
|
-
});
|
|
166
|
-
async function runViteBuild(options) {
|
|
167
|
-
let result;
|
|
168
|
-
const fileName = "index";
|
|
169
|
-
const currentDir = process.cwd();
|
|
170
|
-
try {
|
|
171
|
-
result = await (0, import_vite.build)({
|
|
172
|
-
plugins: [(0, import_vite_plugin_vue2.createVuePlugin)()],
|
|
173
|
-
build: {
|
|
174
|
-
lib: {
|
|
175
|
-
entry: (0, import_path.resolve)(currentDir, options.entry),
|
|
176
|
-
formats: ["es"],
|
|
177
|
-
fileName
|
|
178
|
-
},
|
|
179
|
-
outDir: currentDir,
|
|
180
|
-
emptyOutDir: false,
|
|
181
|
-
rollupOptions: {
|
|
182
|
-
external: ["vue"],
|
|
183
|
-
output: {
|
|
184
|
-
entryFileNames: "[name].js",
|
|
185
|
-
assetFileNames: `${fileName}.[ext]`,
|
|
186
|
-
globals: {
|
|
187
|
-
vue: "Vue"
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
logLevel: "warn"
|
|
193
|
-
});
|
|
194
|
-
} catch (error) {
|
|
195
|
-
log("Build failed", "error");
|
|
196
|
-
throw error;
|
|
197
|
-
}
|
|
198
|
-
log("Build successful", "success");
|
|
199
|
-
return result;
|
|
200
|
-
}
|
|
201
|
-
async function build(_options) {
|
|
202
|
-
const options = await normalizeOptions(_options);
|
|
203
|
-
log(`${name} v${version}`);
|
|
204
|
-
log(`Building: ${options.entry}`);
|
|
205
|
-
if (options.watch) {
|
|
206
|
-
log("Running in watch mode");
|
|
207
|
-
}
|
|
208
|
-
const debouncedBuildAll = debouncePromise(async () => {
|
|
209
|
-
runViteBuild(options);
|
|
210
|
-
}, 100, handleError);
|
|
211
|
-
const startWatcher = async () => {
|
|
212
|
-
if (!options.watch)
|
|
213
|
-
return;
|
|
214
|
-
const { watch } = await import("chokidar");
|
|
215
|
-
const ignored = [
|
|
216
|
-
"**/{.git,node_modules}/**",
|
|
217
|
-
"index.js"
|
|
218
|
-
];
|
|
219
|
-
const watchPaths = typeof options.watch === "boolean" ? (0, import_path.dirname)(options.entry) : Array.isArray(options.watch) ? options.watch.filter((path) => typeof path === "string") : options.watch;
|
|
220
|
-
log(`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`);
|
|
221
|
-
const watcher = watch(watchPaths, {
|
|
222
|
-
ignoreInitial: true,
|
|
223
|
-
ignorePermissionErrors: true,
|
|
224
|
-
ignored
|
|
225
|
-
});
|
|
226
|
-
watcher.on("all", async (type, file) => {
|
|
227
|
-
log(`Change detected: ${type} ${file}`);
|
|
228
|
-
debouncedBuildAll();
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
await runViteBuild(options);
|
|
232
|
-
startWatcher();
|
|
233
|
-
}
|
|
234
|
-
var import_path, import_fs, import_vite, import_vite_plugin_vue2, normalizeOptions;
|
|
235
|
-
var init_src = __esm({
|
|
236
|
-
"src/index.ts"() {
|
|
237
|
-
init_cjs_shims();
|
|
238
|
-
import_path = __toModule(require("path"));
|
|
239
|
-
import_fs = __toModule(require("fs"));
|
|
240
|
-
import_vite = __toModule(require("vite"));
|
|
241
|
-
import_vite_plugin_vue2 = __toModule(require("vite-plugin-vue2"));
|
|
242
|
-
init_errors();
|
|
243
|
-
init_utils();
|
|
244
|
-
init_log();
|
|
245
|
-
init_package();
|
|
246
|
-
normalizeOptions = async (options) => {
|
|
247
|
-
if (!options.entry) {
|
|
248
|
-
throw new PrettyError(`No input file, try "${name} <path/to/file.js>"`);
|
|
249
|
-
}
|
|
250
|
-
if (!(0, import_fs.existsSync)(options.entry)) {
|
|
251
|
-
throw new PrettyError(`Cannot find ${options.entry}`);
|
|
252
|
-
}
|
|
253
|
-
return options;
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
// src/cli-main.ts
|
|
259
|
-
__export(exports, {
|
|
260
|
-
main: () => main
|
|
261
|
-
});
|
|
262
|
-
init_cjs_shims();
|
|
263
|
-
var import_cac = __toModule(require("cac"));
|
|
264
|
-
init_package();
|
|
265
|
-
async function main(options = {}) {
|
|
266
|
-
const cli = (0, import_cac.cac)(name);
|
|
267
|
-
cli.command("[file]", "Panel input file", {
|
|
268
|
-
ignoreOptionDefaultValue: true
|
|
269
|
-
}).option("--watch [path]", 'Watch mode, if path is not specified, it watches the folder of the input file. Repeat "--watch" for more than one path').action(async (file, flags) => {
|
|
270
|
-
const { build: build2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
271
|
-
Object.assign(options, __spreadValues({}, flags));
|
|
272
|
-
if (file) {
|
|
273
|
-
options.entry = file;
|
|
274
|
-
}
|
|
275
|
-
await build2(options);
|
|
276
|
-
});
|
|
277
|
-
cli.help();
|
|
278
|
-
cli.version(version);
|
|
279
|
-
cli.parse(process.argv, { run: false });
|
|
280
|
-
await cli.runMatchedCommand();
|
|
281
|
-
}
|
|
282
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
283
|
-
0 && (module.exports = {
|
|
284
|
-
main
|
|
285
|
-
});
|
package/dist/types-3e4aea23.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Mark some properties as required, leaving others unchanged */
|
|
2
|
-
declare type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;
|
|
3
|
-
/** Array, or not yet an array */
|
|
4
|
-
declare type Arrayable<T> = T | Array<T>;
|
|
5
|
-
declare type Options = {
|
|
6
|
-
entry?: string;
|
|
7
|
-
watch?: Arrayable<boolean | string>;
|
|
8
|
-
};
|
|
9
|
-
declare type NormalizedOptions = MarkRequired<Options, 'entry'>;
|
|
10
|
-
|
|
11
|
-
export { Arrayable as A, NormalizedOptions as N, Options as O };
|