@stencil/cli 5.0.0-alpha.7 → 5.0.0-alpha.8

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 CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as d from "@stencil/core/compiler";
2
- import { LogLevel } from "@stencil/core/compiler";
2
+ import { ConfigCompat, LogLevel, OutputTarget } from "@stencil/core/compiler";
3
3
 
4
4
  //#region src/types.d.ts
5
5
  /**
6
6
  * Supported CLI task commands
7
7
  */
8
- type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'init' | 'migrate' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
8
+ type TaskCommand = 'add' | 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'init' | 'migrate' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
9
9
  //#endregion
10
10
  //#region src/config-flags.d.ts
11
11
  /**
@@ -151,14 +151,43 @@ declare const run: (init: d.CliInitOptions) => Promise<any>;
151
151
  declare const runTask: (coreCompiler: CoreCompiler, config: d.Config, task: TaskCommand, sys: d.CompilerSystem, flags?: ConfigFlags) => Promise<void>;
152
152
  //#endregion
153
153
  //#region src/wizard/types.d.ts
154
+ /**
155
+ * Stable, plugin-relevant subset of the compiler's resolved project config.
156
+ * Fields are fully resolved - paths are absolute, defaults are applied.
157
+ * Prefer this over reading `stencil.config.ts` directly.
158
+ */
159
+ interface ProjectConfig {
160
+ /** Absolute path to the project root. */
161
+ rootDir: string;
162
+ /** Absolute path to the source directory (default: `<rootDir>/src`). */
163
+ srcDir: string;
164
+ /** Component namespace, e.g. `"MyLib"`. Used in generated code and registry names. */
165
+ namespace: string;
166
+ /** Filesystem-safe namespace: `namespace.toLowerCase()` unless overridden. Used in output file/directory names. */
167
+ fsNamespace: string;
168
+ /** Fully resolved output targets with all defaults applied. */
169
+ outputTargets: ReadonlyArray<OutputTarget>;
170
+ /** Absolute path to the global script, if configured. */
171
+ globalScript?: string;
172
+ /** Absolute path to the global stylesheet, if configured. */
173
+ globalStyle?: string;
174
+ /** Backwards-compatibility flags (`compat` in stencil.config.ts). */
175
+ compat?: ConfigCompat;
176
+ /** Enable signal-based reactivity backing (top-level in stencil.config.ts). */
177
+ signalBacking?: boolean;
178
+ }
154
179
  /**
155
180
  * Context passed to wizard steps at runtime.
156
181
  */
157
182
  interface WizardContext {
158
- /** Absolute path to the project root directory. */
159
- rootDir: string;
160
183
  /** True when `stencil.config.ts` did not previously exist (fresh scaffold). */
161
184
  isNewProject: boolean;
185
+ /** Clack prompts - use instead of importing `@clack/prompts` directly for consistent UX. */
186
+ prompts: typeof import('@clack/prompts');
187
+ /** nypm - use instead of importing `nypm` directly so the package manager is auto-detected. */
188
+ nypm: typeof import('nypm');
189
+ /** Resolved project config. See {@link ProjectConfig} for available fields. */
190
+ config: ProjectConfig;
162
191
  }
163
192
  /**
164
193
  * A single file a plugin can offer during `stencil generate`.
@@ -183,17 +212,31 @@ interface WizardFileTemplate {
183
212
  /** Pre-selected in the generate prompt. Defaults to `true`. */
184
213
  selectedByDefault?: boolean;
185
214
  }
215
+ /**
216
+ * Context passed to dynamic `fileTemplates` resolvers during `stencil generate`.
217
+ */
218
+ interface GenerateContext {
219
+ /** The dash-case component tag name entered by the user. */
220
+ tagName: string;
221
+ /** Resolved project config. See {@link ProjectConfig} for available fields. */
222
+ config: ProjectConfig;
223
+ /** Clack prompts - use instead of importing `@clack/prompts` directly for consistent UX. */
224
+ prompts: typeof import('@clack/prompts');
225
+ /** nypm - use instead of importing `nypm` directly so the package manager is auto-detected. */
226
+ nypm: typeof import('nypm');
227
+ }
186
228
  /**
187
229
  * Contribution a package can make to `stencil generate`.
188
230
  */
189
231
  interface WizardGenerateContribution {
190
232
  /**
191
233
  * Files this plugin can generate alongside the component.
192
- * Each entry appears as a checkbox in the generate prompt.
193
- * A single plugin may contribute multiple entries (e.g. a vitest setup
194
- * with several project configs, each producing a differently-scoped test file).
234
+ *
235
+ * May be a static array or an async function that receives project context
236
+ * (e.g. to read `vitest.config.ts` and offer one template per configured
237
+ * Vitest project). Called after the user enters the component tag name.
195
238
  */
196
- fileTemplates?: ReadonlyArray<WizardFileTemplate>;
239
+ fileTemplates?: ReadonlyArray<WizardFileTemplate> | ((ctx: GenerateContext) => ReadonlyArray<WizardFileTemplate> | Promise<ReadonlyArray<WizardFileTemplate>>);
197
240
  /**
198
241
  * Additional style extensions this package supports (e.g. `['sass', 'scss']`
199
242
  * from `@stencil/sass`). The first entry is used as the default.
@@ -241,4 +284,4 @@ interface StencilWizardPlugin {
241
284
  init?: WizardInitContribution;
242
285
  }
243
286
  //#endregion
244
- export { BOOLEAN_CLI_FLAGS, type ConfigFlags, type StencilWizardPlugin, type TaskCommand, type WizardContext, type WizardFileTemplate, type WizardGenerateContribution, type WizardInitContribution, createConfigFlags, parseFlags, run, runTask };
287
+ export { BOOLEAN_CLI_FLAGS, type ConfigFlags, type GenerateContext, type ProjectConfig, type StencilWizardPlugin, type TaskCommand, type WizardContext, type WizardFileTemplate, type WizardGenerateContribution, type WizardInitContribution, createConfigFlags, parseFlags, run, runTask };