@stencil/cli 5.0.0-alpha.1 → 5.0.0-alpha.12
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 +157 -14
- package/dist/index.mjs +2742 -474
- package/package.json +12 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { LogLevel } from "@stencil/core/compiler";
|
|
1
|
+
import * as d 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' | '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
|
/**
|
|
12
12
|
* All the Boolean options supported by the Stencil CLI
|
|
13
13
|
*/
|
|
14
|
-
declare const BOOLEAN_CLI_FLAGS: readonly ["build", "cache", "checkVersion", "ci", "compare", "debug", "dev", "devtools", "docs", "
|
|
14
|
+
declare const BOOLEAN_CLI_FLAGS: readonly ["build", "cache", "checkVersion", "ci", "compare", "debug", "dev", "devtools", "docs", "dryRun", "help", "log", "open", "prerender", "prerenderExternal", "profile", "serviceWorker", "serve", "skipNodeCheck", "ssr", "verbose", "version", "watch"];
|
|
15
15
|
/**
|
|
16
16
|
* All the Number options supported by the Stencil CLI
|
|
17
17
|
*/
|
|
18
|
-
declare const NUMBER_CLI_FLAGS: readonly ["port"
|
|
18
|
+
declare const NUMBER_CLI_FLAGS: readonly ["port"];
|
|
19
19
|
/**
|
|
20
20
|
* All the String options supported by the Stencil CLI
|
|
21
21
|
*/
|
|
22
|
-
declare const STRING_CLI_FLAGS: readonly ["address", "config", "docsApi", "docsJson", "emulate", "root"
|
|
23
|
-
declare const STRING_ARRAY_CLI_FLAGS: readonly [
|
|
22
|
+
declare const STRING_CLI_FLAGS: readonly ["address", "config", "docsApi", "docsJson", "emulate", "root"];
|
|
23
|
+
declare const STRING_ARRAY_CLI_FLAGS: readonly [];
|
|
24
24
|
/**
|
|
25
25
|
* All the CLI arguments which may have string or number values
|
|
26
26
|
*
|
|
27
|
-
* `maxWorkers`
|
|
28
|
-
*
|
|
27
|
+
* `maxWorkers` controls the number of concurrent workers for Stencil builds.
|
|
28
|
+
* Supports both string (e.g., "50%") and number values.
|
|
29
29
|
*/
|
|
30
30
|
declare const STRING_NUMBER_CLI_FLAGS: readonly ["maxWorkers"];
|
|
31
31
|
/**
|
|
32
32
|
* All the CLI arguments which may have boolean or string values.
|
|
33
33
|
*/
|
|
34
|
-
declare const BOOLEAN_STRING_CLI_FLAGS: readonly ["
|
|
34
|
+
declare const BOOLEAN_STRING_CLI_FLAGS: readonly ["stats"];
|
|
35
35
|
/**
|
|
36
36
|
* All the LogLevel-type options supported by the Stencil CLI
|
|
37
37
|
*
|
|
@@ -123,7 +123,7 @@ declare const createConfigFlags: (init?: Partial<ConfigFlags>) => ConfigFlags;
|
|
|
123
123
|
declare const parseFlags: (args: string[]) => ConfigFlags;
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/load-compiler.d.ts
|
|
126
|
-
type CoreCompiler = typeof
|
|
126
|
+
type CoreCompiler = typeof import('@stencil/core/compiler');
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/run.d.ts
|
|
129
129
|
/**
|
|
@@ -136,7 +136,7 @@ type CoreCompiler = typeof _$_stencil_core_compiler0;
|
|
|
136
136
|
* @param init initial CLI options
|
|
137
137
|
* @returns an empty promise
|
|
138
138
|
*/
|
|
139
|
-
declare const run: (init:
|
|
139
|
+
declare const run: (init: d.CliInitOptions) => Promise<any>;
|
|
140
140
|
/**
|
|
141
141
|
* Run a specified task
|
|
142
142
|
*
|
|
@@ -148,6 +148,149 @@ declare const run: (init: _$_stencil_core_compiler0.CliInitOptions) => Promise<a
|
|
|
148
148
|
* @public
|
|
149
149
|
* @returns a void promise
|
|
150
150
|
*/
|
|
151
|
-
declare const runTask: (coreCompiler: CoreCompiler, config:
|
|
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
|
+
}
|
|
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
|
+
* Absolute path to the monorepo workspace root when the project is part of a
|
|
193
|
+
* workspace, `undefined` for single-package projects.
|
|
194
|
+
*
|
|
195
|
+
* When present, `config.rootDir` is the core Stencil package (e.g.
|
|
196
|
+
* `<workspaceRoot>/packages/core/`). The plugin is responsible for deciding
|
|
197
|
+
* where in the workspace it wants to live and for creating that directory.
|
|
198
|
+
*/
|
|
199
|
+
workspaceRoot?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A single file a plugin can offer during `stencil generate`.
|
|
203
|
+
*/
|
|
204
|
+
interface WizardFileTemplate {
|
|
205
|
+
/** Label shown in the generate prompt checkbox, e.g. `"Spec Test (.spec.tsx)"`. */
|
|
206
|
+
label: string;
|
|
207
|
+
/**
|
|
208
|
+
* File extension used to derive the filename and deduplicate contributions,
|
|
209
|
+
* e.g. `"spec.tsx"` or `"e2e.ts"`.
|
|
210
|
+
*/
|
|
211
|
+
extension: string;
|
|
212
|
+
/**
|
|
213
|
+
* Subdirectory within the component directory where the file is placed.
|
|
214
|
+
* e.g. `'test'` to place alongside other test files. Omit for the component root.
|
|
215
|
+
*/
|
|
216
|
+
subdirectory?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Returns the file content. `className` is the PascalCase form of `tagName`.
|
|
219
|
+
*/
|
|
220
|
+
template: (tagName: string, className: string) => string;
|
|
221
|
+
/** Pre-selected in the generate prompt. Defaults to `true`. */
|
|
222
|
+
selectedByDefault?: boolean;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Context passed to dynamic `fileTemplates` resolvers during `stencil generate`.
|
|
226
|
+
*/
|
|
227
|
+
interface GenerateContext {
|
|
228
|
+
/** The dash-case component tag name entered by the user. */
|
|
229
|
+
tagName: string;
|
|
230
|
+
/** Resolved project config. See {@link ProjectConfig} for available fields. */
|
|
231
|
+
config: ProjectConfig;
|
|
232
|
+
/** Clack prompts - use instead of importing `@clack/prompts` directly for consistent UX. */
|
|
233
|
+
prompts: typeof import('@clack/prompts');
|
|
234
|
+
/** nypm - use instead of importing `nypm` directly so the package manager is auto-detected. */
|
|
235
|
+
nypm: typeof import('nypm');
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Contribution a package can make to `stencil generate`.
|
|
239
|
+
*/
|
|
240
|
+
interface WizardGenerateContribution {
|
|
241
|
+
/**
|
|
242
|
+
* Files this plugin can generate alongside the component.
|
|
243
|
+
*
|
|
244
|
+
* May be a static array or an async function that receives project context
|
|
245
|
+
* (e.g. to read `vitest.config.ts` and offer one template per configured
|
|
246
|
+
* Vitest project). Called after the user enters the component tag name.
|
|
247
|
+
*/
|
|
248
|
+
fileTemplates?: ReadonlyArray<WizardFileTemplate> | ((ctx: GenerateContext) => ReadonlyArray<WizardFileTemplate> | Promise<ReadonlyArray<WizardFileTemplate>>);
|
|
249
|
+
/**
|
|
250
|
+
* Additional style extensions this package supports (e.g. `['sass', 'scss']`
|
|
251
|
+
* from `@stencil/sass`). The first entry is used as the default.
|
|
252
|
+
*/
|
|
253
|
+
styleExtensions?: ReadonlyArray<string>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Contribution a package can make to `stencil init`.
|
|
257
|
+
*
|
|
258
|
+
* The plugin owns its entire setup: prompts, peer dep installs, config file
|
|
259
|
+
* generation, example files, package.json script updates, etc.
|
|
260
|
+
*/
|
|
261
|
+
interface WizardInitContribution {
|
|
262
|
+
/** Stable identifier used to deduplicate across re-runs. */
|
|
263
|
+
id: string;
|
|
264
|
+
/** Human-readable name shown in the prompt list. */
|
|
265
|
+
displayName: string;
|
|
266
|
+
/** One-line description shown alongside the name. */
|
|
267
|
+
description: string;
|
|
268
|
+
/**
|
|
269
|
+
* Called by the CLI after packages are installed. The plugin is responsible
|
|
270
|
+
* for all further setup: additional prompts, peer dep installs, config file
|
|
271
|
+
* writes, example tests, `.gitignore` and `package.json` script updates, etc.
|
|
272
|
+
*/
|
|
273
|
+
run: (context: WizardContext) => Promise<void>;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Interface a package exports to participate in `stencil init` and/or
|
|
277
|
+
* `stencil generate`.
|
|
278
|
+
*
|
|
279
|
+
* Declare the entry point in `package.json`:
|
|
280
|
+
* ```json
|
|
281
|
+
* { "stencil": { "wizard": "./dist/wizard.js" } }
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* Export a named `wizard` constant from that module:
|
|
285
|
+
* ```ts
|
|
286
|
+
* export const wizard: StencilWizardPlugin = { ... };
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
interface StencilWizardPlugin {
|
|
290
|
+
/** Contributions to `stencil generate`. */
|
|
291
|
+
generate?: WizardGenerateContribution;
|
|
292
|
+
/** Contributions to `stencil init`. */
|
|
293
|
+
init?: WizardInitContribution;
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
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 };
|