@stencil/cli 5.0.0-alpha.30 → 5.0.0-alpha.31

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.
Files changed (2) hide show
  1. package/dist/index.mjs +62 -1
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -1217,7 +1217,7 @@ async function isExistingStencilProject(dir) {
1217
1217
  }
1218
1218
  //#endregion
1219
1219
  //#region src/wizard/splash.ts
1220
- const CLI_VERSION = "5.0.0-alpha.30";
1220
+ const CLI_VERSION = "5.0.0-alpha.31";
1221
1221
  const isTTY = process.stdout.isTTY;
1222
1222
  const noColor = !isTTY || "NO_COLOR" in process.env;
1223
1223
  const RESET = noColor ? "" : "\x1B[0m";
@@ -1601,6 +1601,66 @@ const devModeRule = {
1601
1601
  }
1602
1602
  };
1603
1603
  //#endregion
1604
+ //#region src/migrations/rules/enable-import-injection-default.ts
1605
+ /**
1606
+ * Migration rule: drop `extras.enableImportInjection: true`.
1607
+ *
1608
+ * In v4 this flag defaulted to `false`, so an explicit `true` was meaningful. In v5 it
1609
+ * defaults to `true`, so an explicit `true` is now a no-op. `false` (opting out) is left alone.
1610
+ */
1611
+ const enableImportInjectionDefaultRule = {
1612
+ id: "enable-import-injection-default",
1613
+ name: "Drop redundant enableImportInjection: true",
1614
+ description: "Remove 'extras.enableImportInjection: true' now that it's the v5 default",
1615
+ fromVersion: "4.x",
1616
+ toVersion: "5.x",
1617
+ detect(sourceFile) {
1618
+ const matches = [];
1619
+ const visit = (node) => {
1620
+ if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && node.name.text === "enableImportInjection" && node.initializer.kind === ts.SyntaxKind.TrueKeyword) {
1621
+ const parent = node.parent;
1622
+ if (ts.isObjectLiteralExpression(parent)) {
1623
+ const grandparent = parent.parent;
1624
+ if (ts.isPropertyAssignment(grandparent) && ts.isIdentifier(grandparent.name) && grandparent.name.text === "extras") {
1625
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
1626
+ matches.push({
1627
+ node,
1628
+ message: "'extras.enableImportInjection: true' is now the default and can be removed",
1629
+ line: line + 1,
1630
+ column: character + 1
1631
+ });
1632
+ }
1633
+ }
1634
+ }
1635
+ ts.forEachChild(node, visit);
1636
+ };
1637
+ visit(sourceFile);
1638
+ return matches;
1639
+ },
1640
+ transform(sourceFile, matches) {
1641
+ if (matches.length === 0) return sourceFile.getFullText();
1642
+ let text = sourceFile.getFullText();
1643
+ const sorted = [...matches].sort((a, b) => b.node.getStart() - a.node.getStart());
1644
+ for (const match of sorted) {
1645
+ const node = match.node;
1646
+ let start = node.getStart();
1647
+ let end = node.getEnd();
1648
+ const trailingComma = text.slice(end).match(/^(\s*,)/);
1649
+ if (trailingComma) end += trailingComma[1].length;
1650
+ else {
1651
+ const leadingComma = text.slice(0, start).match(/,\s*$/);
1652
+ if (leadingComma) start -= leadingComma[0].length;
1653
+ }
1654
+ text = text.slice(0, start) + text.slice(end);
1655
+ }
1656
+ text = cleanupEmptyExtras$2(text);
1657
+ return text;
1658
+ }
1659
+ };
1660
+ function cleanupEmptyExtras$2(text) {
1661
+ return text.replace(/,?\s*extras\s*:\s*\{\s*\},?/g, "");
1662
+ }
1663
+ //#endregion
1604
1664
  //#region src/migrations/rules/encapsulation-api.ts
1605
1665
  /**
1606
1666
  * Migration rule for the @Component encapsulation API change.
@@ -2835,6 +2895,7 @@ const migrationRules = [
2835
2895
  devModeRule,
2836
2896
  globalStyleInjectRule,
2837
2897
  lightDomPatchesRule,
2898
+ enableImportInjectionDefaultRule,
2838
2899
  extrasToCompatRule,
2839
2900
  suppressWarningsToCompatRule,
2840
2901
  externalRuntimeRule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/cli",
3
- "version": "5.0.0-alpha.30",
3
+ "version": "5.0.0-alpha.31",
4
4
  "description": "CLI for Stencil - Web component compiler",
5
5
  "keywords": [
6
6
  "components",
@@ -42,16 +42,16 @@
42
42
  "nypm": "^0.3.12",
43
43
  "std-env": "^3.10.0",
44
44
  "typescript": ">5.0.0 <7.0.0",
45
- "@stencil/dev-server": "5.0.0-alpha.30",
46
- "@stencil/templates": "5.0.0-alpha.30"
45
+ "@stencil/dev-server": "5.0.0-alpha.31",
46
+ "@stencil/templates": "5.0.0-alpha.31"
47
47
  },
48
48
  "devDependencies": {
49
49
  "tsdown": "^0.22.14",
50
50
  "vitest": "^4.1.10",
51
- "@stencil/core": "5.0.0-alpha.30"
51
+ "@stencil/core": "5.0.0-alpha.31"
52
52
  },
53
53
  "peerDependencies": {
54
- "@stencil/core": "^5.0.0 || 5.0.0-alpha.30"
54
+ "@stencil/core": "^5.0.0 || 5.0.0-alpha.31"
55
55
  },
56
56
  "volta": {
57
57
  "extends": "../../package.json"