@stencil/cli 5.0.0-alpha.6 → 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' | '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
  /**
@@ -150,4 +150,138 @@ declare const run: (init: d.CliInitOptions) => Promise<any>;
150
150
  */
151
151
  declare const runTask: (coreCompiler: CoreCompiler, config: d.Config, task: TaskCommand, sys: d.CompilerSystem, flags?: ConfigFlags) => Promise<void>;
152
152
  //#endregion
153
- export { BOOLEAN_CLI_FLAGS, type ConfigFlags, type TaskCommand, createConfigFlags, parseFlags, run, runTask };
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
+ }
179
+ /**
180
+ * Context passed to wizard steps at runtime.
181
+ */
182
+ interface WizardContext {
183
+ /** True when `stencil.config.ts` did not previously exist (fresh scaffold). */
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;
191
+ }
192
+ /**
193
+ * A single file a plugin can offer during `stencil generate`.
194
+ */
195
+ interface WizardFileTemplate {
196
+ /** Label shown in the generate prompt checkbox, e.g. `"Spec Test (.spec.tsx)"`. */
197
+ label: string;
198
+ /**
199
+ * File extension used to derive the filename and deduplicate contributions,
200
+ * e.g. `"spec.tsx"` or `"e2e.ts"`.
201
+ */
202
+ extension: string;
203
+ /**
204
+ * Subdirectory within the component directory where the file is placed.
205
+ * e.g. `'test'` to place alongside other test files. Omit for the component root.
206
+ */
207
+ subdirectory?: string;
208
+ /**
209
+ * Returns the file content. `className` is the PascalCase form of `tagName`.
210
+ */
211
+ template: (tagName: string, className: string) => string;
212
+ /** Pre-selected in the generate prompt. Defaults to `true`. */
213
+ selectedByDefault?: boolean;
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
+ }
228
+ /**
229
+ * Contribution a package can make to `stencil generate`.
230
+ */
231
+ interface WizardGenerateContribution {
232
+ /**
233
+ * Files this plugin can generate alongside the component.
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.
238
+ */
239
+ fileTemplates?: ReadonlyArray<WizardFileTemplate> | ((ctx: GenerateContext) => ReadonlyArray<WizardFileTemplate> | Promise<ReadonlyArray<WizardFileTemplate>>);
240
+ /**
241
+ * Additional style extensions this package supports (e.g. `['sass', 'scss']`
242
+ * from `@stencil/sass`). The first entry is used as the default.
243
+ */
244
+ styleExtensions?: ReadonlyArray<string>;
245
+ }
246
+ /**
247
+ * Contribution a package can make to `stencil init`.
248
+ *
249
+ * The plugin owns its entire setup: prompts, peer dep installs, config file
250
+ * generation, example files, package.json script updates, etc.
251
+ */
252
+ interface WizardInitContribution {
253
+ /** Stable identifier used to deduplicate across re-runs. */
254
+ id: string;
255
+ /** Human-readable name shown in the prompt list. */
256
+ displayName: string;
257
+ /** One-line description shown alongside the name. */
258
+ description: string;
259
+ /**
260
+ * Called by the CLI after packages are installed. The plugin is responsible
261
+ * for all further setup: additional prompts, peer dep installs, config file
262
+ * writes, example tests, `.gitignore` and `package.json` script updates, etc.
263
+ */
264
+ run: (context: WizardContext) => Promise<void>;
265
+ }
266
+ /**
267
+ * Interface a package exports to participate in `stencil init` and/or
268
+ * `stencil generate`.
269
+ *
270
+ * Declare the entry point in `package.json`:
271
+ * ```json
272
+ * { "stencil": { "wizard": "./dist/wizard.js" } }
273
+ * ```
274
+ *
275
+ * Export a named `wizard` constant from that module:
276
+ * ```ts
277
+ * export const wizard: StencilWizardPlugin = { ... };
278
+ * ```
279
+ */
280
+ interface StencilWizardPlugin {
281
+ /** Contributions to `stencil generate`. */
282
+ generate?: WizardGenerateContribution;
283
+ /** Contributions to `stencil init`. */
284
+ init?: WizardInitContribution;
285
+ }
286
+ //#endregion
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 };