@stencil/cli 5.0.0-alpha.28 → 5.0.0-alpha.29

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,6 +1,5 @@
1
1
  import * as d from "@stencil/core/compiler";
2
2
  import { ConfigCompat, LogLevel, OutputTarget } from "@stencil/core/compiler";
3
-
4
3
  //#region src/types.d.ts
5
4
  /**
6
5
  * Supported CLI task commands
@@ -48,7 +47,7 @@ declare const LOG_LEVEL_CLI_FLAGS: readonly ["logLevel"];
48
47
  * for which we want optional keys, we make all the properties optional (w/ `'?'`)
49
48
  * and possibly null.
50
49
  */
51
- 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; };
52
51
  /**
53
52
  * Type containing the possible Boolean configuration flags, to be included
54
53
  * in ConfigFlags, below
package/dist/index.mjs CHANGED
@@ -198,8 +198,10 @@ const parseCLITerm = (flags, args) => {
198
198
  const [originalArg, value] = parseEqualsArg(arg);
199
199
  setCLIArg(flags, desugarRawAlias(originalArg), normalizeFlagName(originalArg), value);
200
200
  } else if (CLI_FLAG_REGEX.test(arg)) setCLIArg(flags, desugarRawAlias(arg), normalizeFlagName(arg), parseCLIValue(args));
201
- else if (arg.startsWith("--no-") && arg.length > 5) setCLIArg(flags, arg, normalizeNegativeFlagName(arg), "");
202
- else if (arg.startsWith("--no") && (isNegatedBoolean || isNegatedBooleanOrString)) setCLIArg(flags, arg, normalizeNegativeFlagName(arg), "");
201
+ else if (arg.startsWith("--no-") && arg.length > 5) {
202
+ const normalized = normalizeNegativeFlagName(arg);
203
+ setCLIArg(flags, arg, normalized, "");
204
+ } else if (arg.startsWith("--no") && (isNegatedBoolean || isNegatedBooleanOrString)) setCLIArg(flags, arg, normalizeNegativeFlagName(arg), "");
203
205
  else if (arg.startsWith("--") && arg.length > 2) setCLIArg(flags, arg, normalizeFlagName(arg), parseCLIValue(args));
204
206
  else flags.unknownArgs.push(arg);
205
207
  };
@@ -252,52 +254,58 @@ const setCLIArg = (flags, rawArg, normalizedArg, value) => {
252
254
  flags[normalizedArg] = typeof value === "string" ? value === "true" : true;
253
255
  flags.knownArgs.push(rawArg);
254
256
  if (typeof value === "string" && value !== "") flags.knownArgs.push(value);
255
- } else if (readOnlyArrayHasStringMember(STRING_CLI_FLAGS, normalizedArg)) if (typeof value === "string") {
256
- flags[normalizedArg] = value;
257
- flags.knownArgs.push(rawArg);
258
- flags.knownArgs.push(value);
259
- } else throwCLIParsingError(rawArg, "expected a string argument but received nothing");
260
- else if (STRING_ARRAY_CLI_FLAGS.length > 0 && readOnlyArrayHasStringMember(STRING_ARRAY_CLI_FLAGS, normalizedArg)) if (typeof value === "string") {
261
- const flagsRecord = flags;
262
- if (!Array.isArray(flagsRecord[normalizedArg])) flagsRecord[normalizedArg] = [];
263
- const targetArray = flagsRecord[normalizedArg];
264
- if (Array.isArray(targetArray)) {
265
- targetArray.push(value);
257
+ } else if (readOnlyArrayHasStringMember(STRING_CLI_FLAGS, normalizedArg)) {
258
+ if (typeof value === "string") {
259
+ flags[normalizedArg] = value;
266
260
  flags.knownArgs.push(rawArg);
267
261
  flags.knownArgs.push(value);
268
- }
269
- } else throwCLIParsingError(rawArg, "expected a string argument but received nothing");
270
- else if (readOnlyArrayHasStringMember(NUMBER_CLI_FLAGS, normalizedArg)) if (typeof value === "string") {
271
- const parsed = parseInt(value, 10);
272
- if (isNaN(parsed)) throwNumberParsingError(rawArg, value);
273
- else {
274
- flags[normalizedArg] = parsed;
262
+ } else throwCLIParsingError(rawArg, "expected a string argument but received nothing");
263
+ } else if (STRING_ARRAY_CLI_FLAGS.length > 0 && readOnlyArrayHasStringMember(STRING_ARRAY_CLI_FLAGS, normalizedArg)) {
264
+ if (typeof value === "string") {
265
+ const flagsRecord = flags;
266
+ if (!Array.isArray(flagsRecord[normalizedArg])) flagsRecord[normalizedArg] = [];
267
+ const targetArray = flagsRecord[normalizedArg];
268
+ if (Array.isArray(targetArray)) {
269
+ targetArray.push(value);
270
+ flags.knownArgs.push(rawArg);
271
+ flags.knownArgs.push(value);
272
+ }
273
+ } else throwCLIParsingError(rawArg, "expected a string argument but received nothing");
274
+ } else if (readOnlyArrayHasStringMember(NUMBER_CLI_FLAGS, normalizedArg)) {
275
+ if (typeof value === "string") {
276
+ const parsed = parseInt(value, 10);
277
+ if (isNaN(parsed)) throwNumberParsingError(rawArg, value);
278
+ else {
279
+ flags[normalizedArg] = parsed;
280
+ flags.knownArgs.push(rawArg);
281
+ flags.knownArgs.push(value);
282
+ }
283
+ } else throwCLIParsingError(rawArg, "expected a number argument but received nothing");
284
+ } else if (readOnlyArrayHasStringMember(STRING_NUMBER_CLI_FLAGS, normalizedArg)) {
285
+ if (typeof value === "string") {
286
+ if (CLI_ARG_STRING_REGEX.test(value)) flags[normalizedArg] = value;
287
+ else {
288
+ const parsed = Number(value);
289
+ if (isNaN(parsed)) throwNumberParsingError(rawArg, value);
290
+ else flags[normalizedArg] = parsed;
291
+ }
275
292
  flags.knownArgs.push(rawArg);
276
293
  flags.knownArgs.push(value);
277
- }
278
- } else throwCLIParsingError(rawArg, "expected a number argument but received nothing");
279
- else if (readOnlyArrayHasStringMember(STRING_NUMBER_CLI_FLAGS, normalizedArg)) if (typeof value === "string") {
280
- if (CLI_ARG_STRING_REGEX.test(value)) flags[normalizedArg] = value;
281
- else {
282
- const parsed = Number(value);
283
- if (isNaN(parsed)) throwNumberParsingError(rawArg, value);
284
- else flags[normalizedArg] = parsed;
285
- }
286
- flags.knownArgs.push(rawArg);
287
- flags.knownArgs.push(value);
288
- } else throwCLIParsingError(rawArg, "expected a string or a number but received nothing");
289
- else if (readOnlyArrayHasStringMember(BOOLEAN_STRING_CLI_FLAGS, normalizedArg)) {
294
+ } else throwCLIParsingError(rawArg, "expected a string or a number but received nothing");
295
+ } else if (readOnlyArrayHasStringMember(BOOLEAN_STRING_CLI_FLAGS, normalizedArg)) {
290
296
  const derivedValue = typeof value === "string" ? value ? value : false : true;
291
297
  flags[normalizedArg] = derivedValue;
292
298
  flags.knownArgs.push(rawArg);
293
299
  if (typeof derivedValue === "string" && derivedValue) flags.knownArgs.push(derivedValue);
294
- } else if (readOnlyArrayHasStringMember(LOG_LEVEL_CLI_FLAGS, normalizedArg)) if (typeof value === "string") if (isLogLevel(value)) {
295
- flags[normalizedArg] = value;
296
- flags.knownArgs.push(rawArg);
297
- flags.knownArgs.push(value);
298
- } else throwCLIParsingError(rawArg, `expected to receive a valid log level but received "${String(value)}"`);
299
- else throwCLIParsingError(rawArg, "expected to receive a valid log level but received nothing");
300
- else {
300
+ } else if (readOnlyArrayHasStringMember(LOG_LEVEL_CLI_FLAGS, normalizedArg)) {
301
+ if (typeof value === "string") {
302
+ if (isLogLevel(value)) {
303
+ flags[normalizedArg] = value;
304
+ flags.knownArgs.push(rawArg);
305
+ flags.knownArgs.push(value);
306
+ } else throwCLIParsingError(rawArg, `expected to receive a valid log level but received "${String(value)}"`);
307
+ } else throwCLIParsingError(rawArg, "expected to receive a valid log level but received nothing");
308
+ } else {
301
309
  flags.unknownArgs.push(rawArg);
302
310
  if (typeof value === "string") flags.unknownArgs.push(value);
303
311
  }
@@ -448,9 +456,10 @@ const findConfig = async (opts) => {
448
456
  const cwd = sys.getCurrentDirectory();
449
457
  const rootDir = normalizePath(cwd);
450
458
  let configPath = opts.configPath;
451
- if (isString(configPath)) if (!sys.platformPath.isAbsolute(configPath)) configPath = normalizePath(sys.platformPath.join(cwd, configPath));
452
- else configPath = normalizePath(configPath);
453
- else configPath = rootDir;
459
+ if (isString(configPath)) {
460
+ if (!sys.platformPath.isAbsolute(configPath)) configPath = normalizePath(sys.platformPath.join(cwd, configPath));
461
+ else configPath = normalizePath(configPath);
462
+ } else configPath = rootDir;
454
463
  const results = {
455
464
  configPath: null,
456
465
  rootDir: normalizePath(cwd)
@@ -809,7 +818,7 @@ async function loadOne(rootDir, packageName, loader) {
809
818
  async function discoverPlugins(rootDir, loader = (url) => import(url)) {
810
819
  const pkg = await readJson$1(join(rootDir, "package.json"));
811
820
  if (!pkg) return [];
812
- const depNames = [...new Set([...Object.keys(toStringRecord(pkg.dependencies)), ...Object.keys(toStringRecord(pkg.devDependencies))])];
821
+ const depNames = [.../* @__PURE__ */ new Set([...Object.keys(toStringRecord(pkg.dependencies)), ...Object.keys(toStringRecord(pkg.devDependencies))])];
813
822
  const plugins = (await Promise.allSettled(depNames.map((name) => loadOne(rootDir, name, loader)))).filter((r) => r.status === "fulfilled" && r.value !== null).map((r) => r.value);
814
823
  const devEnv = process.env.STENCIL_WIZARD_DEV;
815
824
  if (devEnv) {
@@ -1020,6 +1029,11 @@ async function promptDocs() {
1020
1029
  label: "JSON",
1021
1030
  hint: "docs.json - Stencil / Ionic centric schema"
1022
1031
  },
1032
+ {
1033
+ value: "skill",
1034
+ label: "AI Skill",
1035
+ hint: "dist/skill/SKILL.md - Agent Skill (agentskills.io) reference for AI coding agents"
1036
+ },
1023
1037
  {
1024
1038
  value: "vscode",
1025
1039
  label: "VS Code",
@@ -1203,7 +1217,7 @@ async function isExistingStencilProject(dir) {
1203
1217
  }
1204
1218
  //#endregion
1205
1219
  //#region src/wizard/splash.ts
1206
- const CLI_VERSION = "5.0.0-alpha.28";
1220
+ const CLI_VERSION = "5.0.0-alpha.29";
1207
1221
  const isTTY = process.stdout.isTTY;
1208
1222
  const noColor = !isTTY || "NO_COLOR" in process.env;
1209
1223
  const RESET = noColor ? "" : "\x1B[0m";
@@ -1261,7 +1275,7 @@ async function getInstalledPackageNames(rootDir) {
1261
1275
  try {
1262
1276
  const pkg = JSON.parse(await readFile(join(rootDir, "package.json"), "utf8"));
1263
1277
  const keys = (v) => Object.keys(v !== null && typeof v === "object" ? v : {});
1264
- return new Set([...keys(pkg.dependencies), ...keys(pkg.devDependencies)]);
1278
+ return /* @__PURE__ */ new Set([...keys(pkg.dependencies), ...keys(pkg.devDependencies)]);
1265
1279
  } catch {
1266
1280
  return /* @__PURE__ */ new Set();
1267
1281
  }
@@ -1299,23 +1313,26 @@ async function taskAdd(packages, strictConfig) {
1299
1313
  p.outro("Nothing to do.");
1300
1314
  return;
1301
1315
  }
1302
- if (packagesToInstall.length > 0) if (process.env.STENCIL_WIZARD_DEV) p.log.warn(`Dev mode: skipping install, loading wizard from ${process.env.STENCIL_WIZARD_DEV}`);
1303
- else {
1304
- const s = p.spinner();
1305
- s.start(`Installing ${packagesToInstall.join(", ")}`);
1306
- await addDevDependency(withVersionRanges(packagesToInstall), {
1307
- cwd,
1308
- silent: true
1309
- });
1310
- s.stop("Installed");
1316
+ if (packagesToInstall.length > 0) {
1317
+ if (process.env.STENCIL_WIZARD_DEV) p.log.warn(`Dev mode: skipping install, loading wizard from ${process.env.STENCIL_WIZARD_DEV}`);
1318
+ else {
1319
+ const s = p.spinner();
1320
+ s.start(`Installing ${packagesToInstall.join(", ")}`);
1321
+ await addDevDependency(withVersionRanges(packagesToInstall), {
1322
+ cwd,
1323
+ silent: true
1324
+ });
1325
+ s.stop("Installed");
1326
+ }
1311
1327
  }
1312
1328
  const config = strictConfig ? toProjectConfig(strictConfig) : defaultProjectConfig(cwd);
1329
+ const workspaceRoot = await detectWorkspaceRoot(cwd);
1313
1330
  const context = {
1314
1331
  isNewProject: false,
1315
1332
  prompts: p,
1316
1333
  nypm,
1317
1334
  config,
1318
- workspaceRoot: await detectWorkspaceRoot(cwd),
1335
+ workspaceRoot,
1319
1336
  ts,
1320
1337
  openStencilConfig: () => openStencilConfig(join(config.rootDir, "stencil.config.ts"))
1321
1338
  };
@@ -1463,6 +1480,78 @@ const buildDistDocsRule = {
1463
1480
  }
1464
1481
  };
1465
1482
  //#endregion
1483
+ //#region src/migrations/rules/css-import-query-param.ts
1484
+ /**
1485
+ * Ambient module extensions Stencil declares its own type for. In v5 these
1486
+ * now require a `?stencil` query-param marker (see `stencil-ext-modules.d.ts`)
1487
+ * so the ambient declaration doesn't clash with other `*.css` etc. typings in
1488
+ * a monorepo.
1489
+ */
1490
+ const AMBIENT_ASSET_EXTS = [
1491
+ ".css",
1492
+ ".svg",
1493
+ ".txt",
1494
+ ".frag",
1495
+ ".vert"
1496
+ ];
1497
+ const needsStencilMarker = (specifier) => {
1498
+ if (specifier.includes("?")) return false;
1499
+ const lower = specifier.toLowerCase();
1500
+ return AMBIENT_ASSET_EXTS.some((ext) => lower.endsWith(ext));
1501
+ };
1502
+ /**
1503
+ * Migration rule appending `?stencil` to raw asset import specifiers.
1504
+ *
1505
+ * Migrates:
1506
+ * - `import styles from './my-component.css'` → `import styles from './my-component.css?stencil'`
1507
+ * - `import logo from './logo.svg'` → `import logo from './logo.svg?stencil'`
1508
+ *
1509
+ * Does not touch `styleUrl`/`styleUrls` values in `@Component()` options - those are
1510
+ * compiler-resolved filenames, not import specifiers, and are never typed against the
1511
+ * ambient module declarations.
1512
+ */
1513
+ const cssImportQueryParamRule = {
1514
+ id: "css-import-query-param",
1515
+ name: "Asset Import Query Param",
1516
+ description: "Append '?stencil' to raw *.css/*.svg/*.txt/*.frag/*.vert imports so they match Stencil's ambient module types",
1517
+ fromVersion: "4.x",
1518
+ toVersion: "5.x",
1519
+ detect(sourceFile) {
1520
+ const matches = [];
1521
+ const visit = (node) => {
1522
+ let specifierNode;
1523
+ if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) specifierNode = node.moduleSpecifier;
1524
+ else if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments.length > 0 && ts.isStringLiteral(node.arguments[0])) specifierNode = node.arguments[0];
1525
+ if (specifierNode && needsStencilMarker(specifierNode.text)) {
1526
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(specifierNode.getStart());
1527
+ matches.push({
1528
+ node: specifierNode,
1529
+ message: `Raw asset import '${specifierNode.text}' needs a '?stencil' suffix to match Stencil's ambient module type`,
1530
+ line: line + 1,
1531
+ column: character + 1
1532
+ });
1533
+ }
1534
+ ts.forEachChild(node, visit);
1535
+ };
1536
+ visit(sourceFile);
1537
+ return matches;
1538
+ },
1539
+ transform(sourceFile, matches) {
1540
+ if (matches.length === 0) return sourceFile.getFullText();
1541
+ let text = sourceFile.getFullText();
1542
+ const sortedMatches = [...matches].sort((a, b) => b.node.getStart() - a.node.getStart());
1543
+ for (const match of sortedMatches) {
1544
+ const node = match.node;
1545
+ const start = node.getStart();
1546
+ const end = node.getEnd();
1547
+ const quote = node.getText(sourceFile)[0];
1548
+ const updated = `${quote}${node.text}?stencil${quote}`;
1549
+ text = text.slice(0, start) + updated + text.slice(end);
1550
+ }
1551
+ return text;
1552
+ }
1553
+ };
1554
+ //#endregion
1466
1555
  //#region src/migrations/rules/dev-mode.ts
1467
1556
  /**
1468
1557
  * Migration rule for `devMode` config option removal.
@@ -1569,20 +1658,22 @@ const encapsulationApiRule = {
1569
1658
  const start = prop.getStart();
1570
1659
  const end = prop.getEnd();
1571
1660
  let replacement;
1572
- if (propName === "shadow") if (prop.initializer.kind === ts.SyntaxKind.TrueKeyword) replacement = "encapsulation: { type: 'shadow' }";
1573
- else if (ts.isObjectLiteralExpression(prop.initializer)) {
1574
- const options = [];
1575
- for (const innerProp of prop.initializer.properties) if (ts.isPropertyAssignment(innerProp) && ts.isIdentifier(innerProp.name)) {
1576
- const optName = innerProp.name.text;
1577
- const optValue = innerProp.initializer.getText();
1578
- options.push(`${optName}: ${optValue}`);
1579
- }
1580
- if (options.length > 0) replacement = `encapsulation: { type: 'shadow', ${options.join(", ")} }`;
1581
- else replacement = "encapsulation: { type: 'shadow' }";
1582
- } else replacement = "";
1583
- else if (propName === "scoped") if (prop.initializer.kind === ts.SyntaxKind.TrueKeyword) replacement = "encapsulation: { type: 'scoped' }";
1584
- else replacement = "";
1585
- else continue;
1661
+ if (propName === "shadow") {
1662
+ if (prop.initializer.kind === ts.SyntaxKind.TrueKeyword) replacement = "encapsulation: { type: 'shadow' }";
1663
+ else if (ts.isObjectLiteralExpression(prop.initializer)) {
1664
+ const options = [];
1665
+ for (const innerProp of prop.initializer.properties) if (ts.isPropertyAssignment(innerProp) && ts.isIdentifier(innerProp.name)) {
1666
+ const optName = innerProp.name.text;
1667
+ const optValue = innerProp.initializer.getText();
1668
+ options.push(`${optName}: ${optValue}`);
1669
+ }
1670
+ if (options.length > 0) replacement = `encapsulation: { type: 'shadow', ${options.join(", ")} }`;
1671
+ else replacement = "encapsulation: { type: 'shadow' }";
1672
+ } else replacement = "";
1673
+ } else if (propName === "scoped") {
1674
+ if (prop.initializer.kind === ts.SyntaxKind.TrueKeyword) replacement = "encapsulation: { type: 'scoped' }";
1675
+ else replacement = "";
1676
+ } else continue;
1586
1677
  let endPos = end;
1587
1678
  const afterProp = text.slice(end).match(/^\s*,/);
1588
1679
  if (afterProp && replacement === "") endPos = end + afterProp[0].length;
@@ -2003,7 +2094,7 @@ const hashFileNamesRule = {
2003
2094
  value: node.initializer.getText(sourceFile)
2004
2095
  };
2005
2096
  });
2006
- const TARGET_TYPES = new Set(["loader-bundle", "www"]);
2097
+ const TARGET_TYPES = /* @__PURE__ */ new Set(["loader-bundle", "www"]);
2007
2098
  const insertionsByPos = /* @__PURE__ */ new Map();
2008
2099
  const visit = (node) => {
2009
2100
  if (ts.isObjectLiteralExpression(node)) {
@@ -2080,7 +2171,7 @@ const lightDomPatchesRule = {
2080
2171
  toVersion: "5.x",
2081
2172
  detect(sourceFile) {
2082
2173
  const matches = [];
2083
- const oldKeys = new Set([
2174
+ const oldKeys = /* @__PURE__ */ new Set([
2084
2175
  "experimentalSlotFixes",
2085
2176
  "appendChildSlotFix",
2086
2177
  "cloneNodeFix",
@@ -2400,7 +2491,7 @@ function addExtractedOutputTargets(text, sourceFile, toExtract) {
2400
2491
  * NodeResolve fields that were valid in @rollup/plugin-node-resolve but don't exist
2401
2492
  * in rolldown's native resolver and should be removed.
2402
2493
  */
2403
- const REMOVED_NODE_RESOLVE_FIELDS = new Set([
2494
+ const REMOVED_NODE_RESOLVE_FIELDS = /* @__PURE__ */ new Set([
2404
2495
  "browser",
2405
2496
  "modulePaths",
2406
2497
  "dedupe",
@@ -2614,6 +2705,91 @@ const serviceWorkerDefaultRule = {
2614
2705
  }
2615
2706
  };
2616
2707
  //#endregion
2708
+ //#region src/migrations/rules/suppress-warnings-to-compat.ts
2709
+ /**
2710
+ * Migration rule: move `suppressReservedPublicNameWarnings` / `suppressReservedEventNameWarnings`
2711
+ * off the top level of the config and into `compat`, dropping `Reserved` from their names.
2712
+ *
2713
+ * In v5:
2714
+ * suppressReservedPublicNameWarnings → compat.suppressPublicNameWarnings
2715
+ * suppressReservedEventNameWarnings → compat.suppressEventNameWarnings
2716
+ */
2717
+ const KEY_RENAME = {
2718
+ suppressReservedPublicNameWarnings: "suppressPublicNameWarnings",
2719
+ suppressReservedEventNameWarnings: "suppressEventNameWarnings"
2720
+ };
2721
+ const suppressWarningsToCompatRule = {
2722
+ id: "suppress-warnings-to-compat",
2723
+ name: "Suppress Warnings → Compat",
2724
+ description: "Move 'suppressReservedPublicNameWarnings' / 'suppressReservedEventNameWarnings' into 'compat'",
2725
+ fromVersion: "4.x",
2726
+ toVersion: "5.x",
2727
+ detect(sourceFile) {
2728
+ const matches = [];
2729
+ const visit = (node) => {
2730
+ if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && node.name.text in KEY_RENAME) {
2731
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
2732
+ matches.push({
2733
+ node,
2734
+ message: `'${node.name.text}' has moved to 'compat.${KEY_RENAME[node.name.text]}'`,
2735
+ line: line + 1,
2736
+ column: character + 1
2737
+ });
2738
+ }
2739
+ ts.forEachChild(node, visit);
2740
+ };
2741
+ visit(sourceFile);
2742
+ return matches;
2743
+ },
2744
+ transform(sourceFile, matches) {
2745
+ if (matches.length === 0) return sourceFile.getFullText();
2746
+ const text = sourceFile.getFullText();
2747
+ const edits = [];
2748
+ const newProps = [];
2749
+ for (const match of matches) {
2750
+ const node = match.node;
2751
+ const key = node.name.text;
2752
+ newProps.push(`${KEY_RENAME[key]}: ${node.initializer.getText(sourceFile)}`);
2753
+ let start = node.getStart();
2754
+ let end = node.getEnd();
2755
+ const trailingComma = text.slice(end).match(/^(\s*,)/);
2756
+ if (trailingComma) end += trailingComma[1].length;
2757
+ else {
2758
+ const leadingComma = text.slice(0, start).match(/,\s*$/);
2759
+ if (leadingComma) start -= leadingComma[0].length;
2760
+ }
2761
+ edits.push({
2762
+ start,
2763
+ end,
2764
+ replacement: ""
2765
+ });
2766
+ }
2767
+ const parentObject = matches[0].node.parent;
2768
+ const existingCompat = parentObject.properties.find((p) => ts.isPropertyAssignment(p) && ts.isIdentifier(p.name) && p.name.text === "compat" && ts.isObjectLiteralExpression(p.initializer));
2769
+ if (existingCompat) edits.push(insertIntoObjectLiteral(existingCompat.initializer, newProps));
2770
+ else edits.push(insertIntoObjectLiteral(parentObject, [`compat: { ${newProps.join(", ")} }`]));
2771
+ let result = text;
2772
+ for (const edit of edits.sort((a, b) => b.start - a.start)) result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
2773
+ return result;
2774
+ }
2775
+ };
2776
+ function insertIntoObjectLiteral(obj, newProps) {
2777
+ if (obj.properties.length === 0) {
2778
+ const pos = obj.getStart() + 1;
2779
+ return {
2780
+ start: pos,
2781
+ end: pos,
2782
+ replacement: ` ${newProps.join(", ")} `
2783
+ };
2784
+ }
2785
+ const last = obj.properties[obj.properties.length - 1];
2786
+ return {
2787
+ start: last.getEnd(),
2788
+ end: last.getEnd(),
2789
+ replacement: `, ${newProps.join(", ")}`
2790
+ };
2791
+ }
2792
+ //#endregion
2617
2793
  //#region src/migrations/index.ts
2618
2794
  /**
2619
2795
  * Build a map of local import names to their original names from @stencil/core.
@@ -2660,10 +2836,12 @@ const migrationRules = [
2660
2836
  globalStyleInjectRule,
2661
2837
  lightDomPatchesRule,
2662
2838
  extrasToCompatRule,
2839
+ suppressWarningsToCompatRule,
2663
2840
  externalRuntimeRule,
2664
2841
  hashFileNamesRule,
2665
2842
  rolldownConfigRule,
2666
- serviceWorkerDefaultRule
2843
+ serviceWorkerDefaultRule,
2844
+ cssImportQueryParamRule
2667
2845
  ];
2668
2846
  /**
2669
2847
  * Get all migration rules for a specific version upgrade.
@@ -2773,7 +2951,8 @@ const detectMigrations = async (coreCompiler, config) => {
2773
2951
  const sys = config.sys;
2774
2952
  const logger = config.logger;
2775
2953
  const currentMajor = coreCompiler.version.split(".")[0];
2776
- const rules = getRulesForVersionUpgrade(String(Number(currentMajor) - 1), currentMajor);
2954
+ const fromVersion = String(Number(currentMajor) - 1);
2955
+ const rules = getRulesForVersionUpgrade(fromVersion, currentMajor);
2777
2956
  if (rules.length === 0) return {
2778
2957
  hasMigrations: false,
2779
2958
  totalMatches: 0,
@@ -4176,7 +4355,7 @@ async function taskInit(coreCompiler, strictConfig, loadProjectConfig) {
4176
4355
  async function addCapabilities(cwd, strictConfig) {
4177
4356
  const workspaceRoot = await detectWorkspaceRoot(cwd);
4178
4357
  const raw = JSON.parse(await readFile(join(cwd, "package.json"), "utf8"));
4179
- const installed = new Set([...Object.keys(raw.dependencies ?? {}), ...Object.keys(raw.devDependencies ?? {})]);
4358
+ const installed = /* @__PURE__ */ new Set([...Object.keys(raw.dependencies ?? {}), ...Object.keys(raw.devDependencies ?? {})]);
4180
4359
  const discovered = await discoverPlugins(cwd);
4181
4360
  const configurable = discovered.filter((d) => d.plugin.init);
4182
4361
  const installable = KNOWN_INTEGRATIONS.filter((i) => !installed.has(i.package));
@@ -4227,7 +4406,8 @@ async function addCapabilities(cwd, strictConfig) {
4227
4406
  p.outro("Done! Run pnpm run dev to continue.");
4228
4407
  }
4229
4408
  function toNamespace(name) {
4230
- return toPascalCase(name.replace(/^@[^/]+\//, "").replace(/[/_]/g, "-"));
4409
+ const base = name.replace(/^@[^/]+\//, "");
4410
+ return toPascalCase(base.replace(/[/_]/g, "-"));
4231
4411
  }
4232
4412
  //#endregion
4233
4413
  //#region src/task-serve.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/cli",
3
- "version": "5.0.0-alpha.28",
3
+ "version": "5.0.0-alpha.29",
4
4
  "description": "CLI for Stencil - Web component compiler",
5
5
  "keywords": [
6
6
  "components",
@@ -37,21 +37,21 @@
37
37
  "./cli": "./bin/stencil.mjs"
38
38
  },
39
39
  "dependencies": {
40
- "@clack/prompts": "^1.5.1",
40
+ "@clack/prompts": "^1.7.0",
41
41
  "local-pkg": "^1.2.1",
42
42
  "nypm": "^0.3.12",
43
- "std-env": "^3.8.0",
44
- "typescript": ">4.0.0 <7.0.0",
45
- "@stencil/dev-server": "5.0.0-alpha.28",
46
- "@stencil/templates": "5.0.0-alpha.28"
43
+ "std-env": "^3.10.0",
44
+ "typescript": "^6.0.3",
45
+ "@stencil/templates": "5.0.0-alpha.29",
46
+ "@stencil/dev-server": "5.0.0-alpha.29"
47
47
  },
48
48
  "devDependencies": {
49
- "tsdown": ">=0.21.0 <1.0.0",
50
- "vitest": "^4.1.7",
51
- "@stencil/core": "5.0.0-alpha.28"
49
+ "tsdown": "^0.22.14",
50
+ "vitest": "^4.1.10",
51
+ "@stencil/core": "5.0.0-alpha.29"
52
52
  },
53
53
  "peerDependencies": {
54
- "@stencil/core": "^5.0.0 || 5.0.0-alpha.28"
54
+ "@stencil/core": "^5.0.0 || 5.0.0-alpha.29"
55
55
  },
56
56
  "volta": {
57
57
  "extends": "../../package.json"
File without changes