@stencil/cli 5.0.0-next.0 → 5.0.0-rc.1

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 ADDED
@@ -0,0 +1,72 @@
1
+ # @stencil/cli
2
+
3
+ CLI for [Stencil](https://stenciljs.com) - build, test, and generate web components.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save-dev @stencil/cli @stencil/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Build
15
+ npx stencil build
16
+
17
+ # Build in watch mode
18
+ npx stencil build --watch
19
+
20
+ # Generate a new component
21
+ npx stencil generate my-component
22
+
23
+ # Start dev server
24
+ npx stencil build --dev --watch --serve
25
+ ```
26
+
27
+ ## Programmatic API
28
+
29
+ ### `run(init)` - invoke the CLI from code
30
+
31
+ Mirrors running `stencil <task>` in the terminal. Parse your own `args` array and Stencil handles the rest.
32
+
33
+ ```ts
34
+ import { run } from '@stencil/cli';
35
+ import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node';
36
+
37
+ await run({
38
+ args: ['build', '--dev', '--watch'],
39
+ logger: createNodeLogger(),
40
+ sys: createNodeSys(),
41
+ });
42
+ ```
43
+
44
+ ### `runTask(coreCompiler, config, task, sys, flags?)` - lower-level task execution
45
+
46
+ Use this when you need control over the compiler instance or config before running a task. You are responsible for loading the compiler and config yourself.
47
+
48
+ ```ts
49
+ import * as coreCompiler from '@stencil/core/compiler';
50
+ import { runTask, createConfigFlags } from '@stencil/cli';
51
+ import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node';
52
+
53
+ const logger = createNodeLogger();
54
+ const sys = createNodeSys();
55
+
56
+ // Load and validate stencil.config.ts
57
+ const { config, diagnostics } = await coreCompiler.loadConfig({
58
+ configPath: './stencil.config.ts',
59
+ logger,
60
+ sys,
61
+ });
62
+ if (diagnostics.length) logger.printDiagnostics(diagnostics);
63
+
64
+ // Optional: override config flags (e.g. force dev mode)
65
+ const flags = createConfigFlags({ task: 'build', dev: true });
66
+
67
+ await runTask(coreCompiler, config, 'build', sys, flags);
68
+ ```
69
+
70
+ Valid `task` values: `'build'` | `'docs'` | `'generate'` | `'serve'` | `'prerender'` | `'info'` | `'migrate'` | `'init'` | `'add'`
71
+
72
+ `flags` is optional - if omitted, defaults are derived from the task.
package/bin/stencil.mjs CHANGED
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { run } from '@stencil/cli'
4
- import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node'
3
+ // Set NODE_ENV to production by default (matches legacy webpack bundling behavior)
4
+ // This suppresses development-only warnings from dependencies like PostCSS
5
+ process.env.NODE_ENV ??= 'production';
6
+
7
+ import { run } from '@stencil/cli';
8
+ import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node';
5
9
 
6
10
  run({
7
11
  args: process.argv.slice(2),
8
12
  logger: createNodeLogger(),
9
13
  sys: createNodeSys(),
10
- })
14
+ });
package/dist/index.d.mts CHANGED
@@ -1,31 +1,36 @@
1
- import * as _stencil_core_compiler0 from "@stencil/core/compiler";
2
- import { LogLevel } from "@stencil/core/compiler";
3
-
1
+ import * as d from "@stencil/core/compiler";
2
+ import { ConfigCompat, LogLevel, OutputTarget } from "@stencil/core/compiler";
3
+ //#region src/types.d.ts
4
+ /**
5
+ * Supported CLI task commands
6
+ */
7
+ type TaskCommand = 'add' | 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'init' | 'migrate' | 'prerender' | 'serve' | 'version';
8
+ //#endregion
4
9
  //#region src/config-flags.d.ts
5
10
  /**
6
11
  * All the Boolean options supported by the Stencil CLI
7
12
  */
8
- declare const BOOLEAN_CLI_FLAGS: readonly ["build", "cache", "checkVersion", "ci", "compare", "debug", "dev", "devtools", "docs", "e2e", "es5", "esm", "help", "log", "open", "prerender", "prerenderExternal", "prod", "profile", "serviceWorker", "screenshot", "serve", "skipNodeCheck", "spec", "ssr", "updateScreenshot", "verbose", "version", "watch", "all", "automock", "bail", "changedFilesWithAncestor", "clearCache", "clearMocks", "collectCoverage", "color", "colors", "coverage", "detectLeaks", "detectOpenHandles", "errorOnDeprecated", "expand", "findRelatedTests", "forceExit", "init", "injectGlobals", "json", "lastCommit", "listTests", "logHeapUsage", "noStackTrace", "notify", "onlyChanged", "onlyFailures", "passWithNoTests", "resetMocks", "resetModules", "restoreMocks", "runInBand", "runTestsByPath", "showConfig", "silent", "skipFilter", "testLocationInResults", "updateSnapshot", "useStderr", "watchAll", "watchman"];
13
+ declare const BOOLEAN_CLI_FLAGS: readonly ["cache", "ci", "debug", "dev", "dryRun", "help", "log", "open", "prerender", "profile", "serviceWorker", "serve", "ssr", "verbose", "version", "watch"];
9
14
  /**
10
15
  * All the Number options supported by the Stencil CLI
11
16
  */
12
- declare const NUMBER_CLI_FLAGS: readonly ["port", "maxConcurrency", "testTimeout"];
17
+ declare const NUMBER_CLI_FLAGS: readonly ["port"];
13
18
  /**
14
19
  * All the String options supported by the Stencil CLI
15
20
  */
16
- declare const STRING_CLI_FLAGS: readonly ["address", "config", "docsApi", "docsJson", "emulate", "root", "screenshotConnector", "cacheDirectory", "changedSince", "collectCoverageFrom", "coverageDirectory", "coverageThreshold", "env", "filter", "globalSetup", "globalTeardown", "globals", "haste", "moduleNameMapper", "notifyMode", "outputFile", "preset", "prettierPath", "resolver", "rootDir", "runner", "testEnvironment", "testEnvironmentOptions", "testFailureExitCode", "testNamePattern", "testResultsProcessor", "testRunner", "testSequencer", "testURL", "timers", "transform"];
17
- declare const STRING_ARRAY_CLI_FLAGS: readonly ["collectCoverageOnlyFrom", "coveragePathIgnorePatterns", "coverageReporters", "moduleDirectories", "moduleFileExtensions", "modulePathIgnorePatterns", "modulePaths", "projects", "reporters", "roots", "selectProjects", "setupFiles", "setupFilesAfterEnv", "snapshotSerializers", "testMatch", "testPathIgnorePatterns", "testPathPattern", "testRegex", "transformIgnorePatterns", "unmockedModulePathPatterns", "watchPathIgnorePatterns"];
21
+ declare const STRING_CLI_FLAGS: readonly ["address", "config", "docsJson", "root"];
22
+ declare const STRING_ARRAY_CLI_FLAGS: readonly [];
18
23
  /**
19
24
  * All the CLI arguments which may have string or number values
20
25
  *
21
- * `maxWorkers` is an argument which is used both by Stencil _and_ by Jest,
22
- * which means that we need to support parsing both string and number values.
26
+ * `maxWorkers` controls the number of concurrent workers for Stencil builds.
27
+ * Supports both string (e.g., "50%") and number values.
23
28
  */
24
29
  declare const STRING_NUMBER_CLI_FLAGS: readonly ["maxWorkers"];
25
30
  /**
26
31
  * All the CLI arguments which may have boolean or string values.
27
32
  */
28
- declare const BOOLEAN_STRING_CLI_FLAGS: readonly ["headless", "stats"];
33
+ declare const BOOLEAN_STRING_CLI_FLAGS: readonly ["stats"];
29
34
  /**
30
35
  * All the LogLevel-type options supported by the Stencil CLI
31
36
  *
@@ -42,7 +47,7 @@ declare const LOG_LEVEL_CLI_FLAGS: readonly ["logLevel"];
42
47
  * for which we want optional keys, we make all the properties optional (w/ `'?'`)
43
48
  * and possibly null.
44
49
  */
45
- type ObjectFromKeys<K extends ReadonlyArray<string>, T> = { [key in K[number]]?: T | null };
50
+ type ObjectFromKeys<K extends ReadonlyArray<string>, T> = { [key in K[number]]?: T | null; };
46
51
  /**
47
52
  * Type containing the possible Boolean configuration flags, to be included
48
53
  * in ConfigFlags, below
@@ -117,7 +122,7 @@ declare const createConfigFlags: (init?: Partial<ConfigFlags>) => ConfigFlags;
117
122
  declare const parseFlags: (args: string[]) => ConfigFlags;
118
123
  //#endregion
119
124
  //#region src/load-compiler.d.ts
120
- type CoreCompiler = typeof _stencil_core_compiler0;
125
+ type CoreCompiler = typeof import('@stencil/core/compiler');
121
126
  //#endregion
122
127
  //#region src/run.d.ts
123
128
  /**
@@ -130,7 +135,7 @@ type CoreCompiler = typeof _stencil_core_compiler0;
130
135
  * @param init initial CLI options
131
136
  * @returns an empty promise
132
137
  */
133
- declare const run: (init: _stencil_core_compiler0.CliInitOptions) => Promise<void>;
138
+ declare const run: (init: d.CliInitOptions) => Promise<any>;
134
139
  /**
135
140
  * Run a specified task
136
141
  *
@@ -142,9 +147,344 @@ declare const run: (init: _stencil_core_compiler0.CliInitOptions) => Promise<voi
142
147
  * @public
143
148
  * @returns a void promise
144
149
  */
145
- declare const runTask: (coreCompiler: CoreCompiler, config: _stencil_core_compiler0.Config, task: TaskCommand, sys: _stencil_core_compiler0.CompilerSystem, flags?: ConfigFlags) => Promise<void>;
150
+ declare const runTask: (coreCompiler: CoreCompiler, config: d.Config, task: TaskCommand, sys: d.CompilerSystem, flags?: ConfigFlags) => Promise<void>;
146
151
  //#endregion
147
- //#region src/index.d.ts
148
- type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
152
+ //#region src/wizard/types.d.ts
153
+ /**
154
+ * Stable, plugin-relevant subset of the compiler's resolved project config.
155
+ * Fields are fully resolved - paths are absolute, defaults are applied.
156
+ * Prefer this over reading `stencil.config.ts` directly.
157
+ */
158
+ interface ProjectConfig {
159
+ /** Absolute path to the project root. */
160
+ rootDir: string;
161
+ /** Absolute path to the source directory (default: `<rootDir>/src`). */
162
+ srcDir: string;
163
+ /** Component namespace, e.g. `"MyLib"`. Used in generated code and registry names. */
164
+ namespace: string;
165
+ /** Filesystem-safe namespace: `namespace.toLowerCase()` unless overridden. Used in output file/directory names. */
166
+ fsNamespace: string;
167
+ /** Fully resolved output targets with all defaults applied. */
168
+ outputTargets: ReadonlyArray<OutputTarget>;
169
+ /** Absolute path to the global script, if configured. */
170
+ globalScript?: string;
171
+ /** Absolute path to the global stylesheet, if configured. */
172
+ globalStyle?: string;
173
+ /** Backwards-compatibility flags (`compat` in stencil.config.ts). */
174
+ compat?: ConfigCompat;
175
+ /** Enable signal-based reactivity backing (top-level in stencil.config.ts). */
176
+ signalBacking?: boolean;
177
+ /**
178
+ * Whether the build writes an `exports` map into the project's `package.json`. When `true`,
179
+ * consumers can only import the paths that map lists (e.g. `<pkg>/ssr`, not `<pkg>/dist/ssr`).
180
+ */
181
+ generateExportMaps?: boolean;
182
+ }
183
+ /**
184
+ * Structured editor for `stencil.config.ts`, backed by the TypeScript compiler API.
185
+ * Obtain one via {@link WizardContext.openStencilConfig}.
186
+ *
187
+ * All mutation methods accumulate edits in memory. Call {@link save} once to
188
+ * write them all back to disk in a single pass.
189
+ *
190
+ * @example
191
+ * const editor = await ctx.openStencilConfig();
192
+ * editor.addImport('@stencil/vue-output-target', ['vueOutputTarget']);
193
+ * editor.addOutputTarget("vueOutputTarget({ proxiesFile: '../vue-lib/src/components.ts' })");
194
+ * await editor.save();
195
+ */
196
+ interface StencilConfigEditor {
197
+ /**
198
+ * Returns `true` if any import from `moduleSpecifier` already exists in the file.
199
+ *
200
+ * @example
201
+ * if (!editor.hasImport('@stencil/vue-output-target')) {
202
+ * editor.addImport('@stencil/vue-output-target', ['vueOutputTarget']);
203
+ * }
204
+ */
205
+ hasImport(moduleSpecifier: string): boolean;
206
+ /**
207
+ * Adds `import { ...namedImports } from 'moduleSpecifier'` after the last
208
+ * existing import in the file. No-op if any import from `moduleSpecifier`
209
+ * already exists.
210
+ *
211
+ * @param moduleSpecifier - The module to import from, e.g. `'@stencil/sass'`.
212
+ * @param namedImports - At least one named export to import.
213
+ *
214
+ * @example
215
+ * editor.addImport('@stencil/vue-output-target', ['vueOutputTarget']);
216
+ * // > import { vueOutputTarget } from '@stencil/vue-output-target';
217
+ *
218
+ * @example
219
+ * editor.addImport('@stencil/sass', ['sass']);
220
+ * // > import { sass } from '@stencil/sass';
221
+ */
222
+ addImport(moduleSpecifier: string, namedImports: [string, ...string[]]): void;
223
+ /**
224
+ * Returns `true` if `substring` appears anywhere in the text of the
225
+ * `outputTargets` array. Use this to guard against adding the same target twice.
226
+ *
227
+ * @example
228
+ * if (!editor.outputTargetsContains('vueOutputTarget(')) {
229
+ * editor.addOutputTarget("vueOutputTarget({ proxiesFile: '../vue-lib/src/components.ts' })");
230
+ * }
231
+ */
232
+ outputTargetsContains(substring: string): boolean;
233
+ /**
234
+ * Appends `expression` as a new element in the `outputTargets` array,
235
+ * creating the `outputTargets` property if it is absent from the config.
236
+ *
237
+ * `expression` is a TypeScript expression that is inserted verbatim into
238
+ * the source file. It must evaluate to a value assignable to {@link OutputTarget}
239
+ * - built-in targets use object literal syntax (e.g. `"{ type: 'standalone' }"`),
240
+ * while third-party targets are function calls that return `OutputTargetCustom`
241
+ * (e.g. `"vueOutputTarget({...})"`). Call {@link addImport} first to bring the
242
+ * factory function into scope.
243
+ *
244
+ * @param expression - A TypeScript expression, e.g. `"{ type: 'standalone' }"`
245
+ * or `"vueOutputTarget({ proxiesFile: '../vue-lib/src/components.ts' })"`.
246
+ *
247
+ * @example
248
+ * // Built-in target (object literal):
249
+ * editor.addOutputTarget("{ type: 'standalone' }");
250
+ *
251
+ * @example
252
+ * // Third-party target (OutputTargetCustom - add the import first):
253
+ * editor.addImport('@stencil/vue-output-target', ['vueOutputTarget']);
254
+ * editor.addOutputTarget("vueOutputTarget({ proxiesFile: '../vue-lib/src/components.ts' })");
255
+ */
256
+ addOutputTarget(expression: string): void;
257
+ /**
258
+ * Replaces the first element in the `outputTargets` array whose text contains
259
+ * `substring` with `expression` in-place. Returns `true` if a match was found
260
+ * and replaced, `false` if no element contained `substring`.
261
+ *
262
+ * Useful for the reconfigure flow — the replaced target stays at the same
263
+ * position in the array rather than being moved to the end.
264
+ *
265
+ * @example
266
+ * // Replace if already configured, otherwise append:
267
+ * if (!editor.replaceOutputTarget('vueOutputTarget(', newExpression)) {
268
+ * editor.addOutputTarget(newExpression);
269
+ * }
270
+ */
271
+ replaceOutputTarget(substring: string, expression: string): boolean;
272
+ /**
273
+ * Removes the first element in the `outputTargets` array whose text contains
274
+ * `substring`. Returns `true` if an element was removed, `false` if no match
275
+ * was found.
276
+ *
277
+ * @example
278
+ * editor.removeOutputTarget('vueOutputTarget(');
279
+ */
280
+ removeOutputTarget(substring: string): boolean;
281
+ /**
282
+ * Returns `true` if `substring` appears anywhere in the text of the
283
+ * `plugins` array. Use this to guard against adding the same plugin twice.
284
+ *
285
+ * @example
286
+ * if (!editor.pluginsContains('sass(')) {
287
+ * editor.addPlugin('sass()');
288
+ * }
289
+ */
290
+ pluginsContains(substring: string): boolean;
291
+ /**
292
+ * Appends `expression` as a new element in the `plugins` array,
293
+ * creating the `plugins` property if it is absent from the config.
294
+ *
295
+ * `expression` is a TypeScript expression that is inserted verbatim into
296
+ * the source file. Call {@link addImport} first to bring the plugin factory
297
+ * into scope.
298
+ *
299
+ * @param expression - A TypeScript expression, e.g. `'sass()'` or
300
+ * `"sass({ injectGlobalPaths: ['src/global/variables.scss'] })"`.
301
+ *
302
+ * @example
303
+ * editor.addImport('@stencil/sass', ['sass']);
304
+ * editor.addPlugin('sass()');
305
+ *
306
+ * @example
307
+ * editor.addImport('@stencil/sass', ['sass']);
308
+ * editor.addPlugin("sass({ injectGlobalPaths: ['src/global/variables.scss'] })");
309
+ */
310
+ addPlugin(expression: string): void;
311
+ /**
312
+ * Replaces the first element in the `plugins` array whose text contains
313
+ * `substring` with `expression` in-place. Returns `true` if a match was found
314
+ * and replaced, `false` if no element contained `substring`.
315
+ *
316
+ * @example
317
+ * if (!editor.replacePlugin('sass(', newSassCall)) {
318
+ * editor.addPlugin(newSassCall);
319
+ * }
320
+ */
321
+ replacePlugin(substring: string, expression: string): boolean;
322
+ /**
323
+ * Removes the first element in the `plugins` array whose text contains
324
+ * `substring`. Returns `true` if an element was removed, `false` if no match
325
+ * was found.
326
+ *
327
+ * @example
328
+ * editor.removePlugin('sass(');
329
+ */
330
+ removePlugin(substring: string): boolean;
331
+ /**
332
+ * Sets a top-level property on the config object to `expression`, replacing its
333
+ * value if the property already exists, or adding it (after `namespace`, when
334
+ * present) if it doesn't.
335
+ *
336
+ * @param name - The config property, e.g. `'generateExportMaps'`.
337
+ * @param expression - A TypeScript expression, inserted verbatim, e.g. `'true'`.
338
+ *
339
+ * @example
340
+ * editor.setProperty('generateExportMaps', 'true');
341
+ * // > generateExportMaps: true,
342
+ */
343
+ setProperty(name: string, expression: string): void;
344
+ /** Write all accumulated edits back to disk. */
345
+ save(): Promise<void>;
346
+ }
347
+ /**
348
+ * Context passed to wizard steps at runtime.
349
+ */
350
+ interface WizardContext {
351
+ /** True when `stencil.config.ts` did not previously exist (fresh scaffold). */
352
+ isNewProject: boolean;
353
+ /** Clack prompts - use instead of importing `@clack/prompts` directly for consistent UX. */
354
+ prompts: typeof import('@clack/prompts');
355
+ /** nypm - use instead of importing `nypm` directly so the package manager is auto-detected. */
356
+ nypm: typeof import('nypm');
357
+ /** Resolved project config. See {@link ProjectConfig} for available fields. */
358
+ config: ProjectConfig;
359
+ /**
360
+ * Absolute path to the monorepo workspace root when the project is part of a
361
+ * workspace, `undefined` for single-package projects.
362
+ *
363
+ * When present, `config.rootDir` is the core Stencil package (e.g.
364
+ * `<workspaceRoot>/packages/core/`). The plugin is responsible for deciding
365
+ * where in the workspace it wants to live and for creating that directory.
366
+ */
367
+ workspaceRoot?: string;
368
+ /**
369
+ * Open the project's `stencil.config.ts` for structured editing.
370
+ * Use the returned {@link StencilConfigEditor} to add imports, output targets,
371
+ * and plugins, then call `save()` to persist.
372
+ *
373
+ * Use {@link ts} directly when you need to manipulate other files or perform
374
+ * operations the editor does not cover.
375
+ */
376
+ openStencilConfig: () => Promise<StencilConfigEditor>;
377
+ /**
378
+ * TypeScript compiler API. Available for advanced AST manipulation beyond
379
+ * what {@link openStencilConfig} covers.
380
+ */
381
+ ts: typeof import('typescript');
382
+ }
383
+ /**
384
+ * What `stencil generate` is creating - passed to each {@link WizardFileTemplate.template}.
385
+ */
386
+ interface GeneratedComponentInfo {
387
+ /**
388
+ * `true` for a CSS-only component: a `@component`-marked stylesheet with no JS class, so there's
389
+ * nothing to import - refer to it by tag name.
390
+ */
391
+ cssOnly: boolean;
392
+ }
393
+ /**
394
+ * A single file a plugin can offer during `stencil generate`.
395
+ */
396
+ interface WizardFileTemplate {
397
+ /** Label shown in the generate prompt checkbox, e.g. `"Spec Test (.spec.tsx)"`. */
398
+ label: string;
399
+ /**
400
+ * File extension used to derive the filename and deduplicate contributions,
401
+ * e.g. `"spec.tsx"` or `"e2e.ts"`.
402
+ */
403
+ extension: string;
404
+ /**
405
+ * Subdirectory within the component directory where the file is placed.
406
+ * e.g. `'test'` to place alongside other test files. Omit for the component root.
407
+ */
408
+ subdirectory?: string;
409
+ /**
410
+ * Returns the file content. `className` is the PascalCase form of `tagName`.
411
+ */
412
+ template: (tagName: string, className: string, component: GeneratedComponentInfo) => string;
413
+ /** Pre-selected in the generate prompt. Defaults to `true`. */
414
+ selectedByDefault?: boolean;
415
+ }
416
+ /**
417
+ * Context passed to dynamic `fileTemplates` resolvers during `stencil generate`.
418
+ */
419
+ interface GenerateContext {
420
+ /** The dash-case component tag name entered by the user. */
421
+ tagName: string;
422
+ /** `true` when generating a CSS-only component - e.g. to leave out templates that need a JS class. */
423
+ cssOnly: boolean;
424
+ /** Resolved project config. See {@link ProjectConfig} for available fields. */
425
+ config: ProjectConfig;
426
+ /** Clack prompts - use instead of importing `@clack/prompts` directly for consistent UX. */
427
+ prompts: typeof import('@clack/prompts');
428
+ /** nypm - use instead of importing `nypm` directly so the package manager is auto-detected. */
429
+ nypm: typeof import('nypm');
430
+ }
431
+ /**
432
+ * Contribution a package can make to `stencil generate`.
433
+ */
434
+ interface WizardGenerateContribution {
435
+ /**
436
+ * Files this plugin can generate alongside the component.
437
+ *
438
+ * May be a static array or an async function that receives project context
439
+ * (e.g. to read `vitest.config.ts` and offer one template per configured
440
+ * Vitest project). Called after the user enters the component tag name.
441
+ */
442
+ fileTemplates?: ReadonlyArray<WizardFileTemplate> | ((ctx: GenerateContext) => ReadonlyArray<WizardFileTemplate> | Promise<ReadonlyArray<WizardFileTemplate>>);
443
+ /**
444
+ * Additional style extensions this package supports (e.g. `['sass', 'scss']`
445
+ * from `@stencil/sass`). The first entry is used as the default.
446
+ */
447
+ styleExtensions?: ReadonlyArray<string>;
448
+ }
449
+ /**
450
+ * Contribution a package can make to `stencil init`.
451
+ *
452
+ * The plugin owns its entire setup: prompts, peer dep installs, config file
453
+ * generation, example files, package.json script updates, etc.
454
+ */
455
+ interface WizardInitContribution {
456
+ /** Stable identifier used to deduplicate across re-runs. */
457
+ id: string;
458
+ /** Human-readable name shown in the prompt list. */
459
+ displayName: string;
460
+ /** One-line description shown alongside the name. */
461
+ description: string;
462
+ /**
463
+ * Called by the CLI after packages are installed. The plugin is responsible
464
+ * for all further setup: additional prompts, peer dep installs, config file
465
+ * writes, example tests, `.gitignore` and `package.json` script updates, etc.
466
+ */
467
+ run: (context: WizardContext) => Promise<void>;
468
+ }
469
+ /**
470
+ * Interface a package exports to participate in `stencil init` and/or
471
+ * `stencil generate`.
472
+ *
473
+ * Declare the entry point in `package.json`:
474
+ * ```json
475
+ * { "stencil": { "wizard": "./dist/wizard.js" } }
476
+ * ```
477
+ *
478
+ * Export a named `wizard` constant from that module:
479
+ * ```ts
480
+ * export const wizard: StencilWizardPlugin = { ... };
481
+ * ```
482
+ */
483
+ interface StencilWizardPlugin {
484
+ /** Contributions to `stencil generate`. */
485
+ generate?: WizardGenerateContribution;
486
+ /** Contributions to `stencil init`. */
487
+ init?: WizardInitContribution;
488
+ }
149
489
  //#endregion
150
- export { BOOLEAN_CLI_FLAGS, type ConfigFlags, TaskCommand, createConfigFlags, parseFlags, run, runTask };
490
+ export { BOOLEAN_CLI_FLAGS, type ConfigFlags, type GenerateContext, type GeneratedComponentInfo, type ProjectConfig, type StencilConfigEditor, type StencilWizardPlugin, type TaskCommand, type WizardContext, type WizardFileTemplate, type WizardGenerateContribution, type WizardInitContribution, createConfigFlags, parseFlags, run, runTask };