@stencil/cli 5.0.0-alpha.25 → 5.0.0-alpha.26

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 +30 -3
  2. package/package.json +6 -5
package/dist/index.mjs CHANGED
@@ -9,6 +9,7 @@ import { addDevDependency, detectPackageManager, installDependencies } from "nyp
9
9
  import { isCI } from "std-env";
10
10
  import ts from "typescript";
11
11
  import { pathToFileURL } from "node:url";
12
+ import { getPackageInfo } from "local-pkg";
12
13
  import { existsSync } from "node:fs";
13
14
  import { homedir } from "node:os";
14
15
  import { dirname as dirname$1, isAbsolute, join as join$1, relative as relative$1 } from "path";
@@ -768,9 +769,11 @@ async function readJson$1(filePath) {
768
769
  }
769
770
  }
770
771
  async function loadOne(rootDir, packageName, loader) {
771
- const wizardEntry = ((await readJson$1(join(rootDir, "node_modules", packageName, "package.json")))?.stencil)?.wizard;
772
+ const info = await getPackageInfo(packageName, { paths: [rootDir] });
773
+ if (!info) return null;
774
+ const wizardEntry = info.packageJson.stencil?.wizard;
772
775
  if (!wizardEntry) return null;
773
- const wizardPath = join(rootDir, "node_modules", packageName, wizardEntry);
776
+ const wizardPath = join(info.rootPath, wizardEntry);
774
777
  let mod;
775
778
  try {
776
779
  mod = await loader(pathToFileURL(wizardPath).href);
@@ -1194,7 +1197,7 @@ async function isExistingStencilProject(dir) {
1194
1197
  }
1195
1198
  //#endregion
1196
1199
  //#region src/wizard/splash.ts
1197
- const CLI_VERSION = "5.0.0-alpha.25";
1200
+ const CLI_VERSION = "5.0.0-alpha.26";
1198
1201
  const isTTY = process.stdout.isTTY;
1199
1202
  const noColor = !isTTY || "NO_COLOR" in process.env;
1200
1203
  const RESET = noColor ? "" : "\x1B[0m";
@@ -4016,6 +4019,24 @@ async function applyPackageJsonFields(rootDir, fields) {
4016
4019
  }
4017
4020
  //#endregion
4018
4021
  //#region src/task-init.ts
4022
+ /**
4023
+ * Package managers can report success while silently failing to write to node_modules
4024
+ * (observed with npm computing a resolved lockfile but reifying zero filesystem changes).
4025
+ * Confirms packages actually landed on disk instead of trusting the install call's exit code.
4026
+ *
4027
+ * @param rootDir - directory to resolve packages from.
4028
+ * @param packageNames - packages that were just supposed to be installed.
4029
+ * @returns names that failed to resolve; empty when everything installed correctly.
4030
+ */
4031
+ async function verifyInstalled(rootDir, packageNames) {
4032
+ const missing = [];
4033
+ for (const name of packageNames) if (!await getPackageInfo(name, { paths: [rootDir] })) missing.push(name);
4034
+ return missing;
4035
+ }
4036
+ function failInstallVerification(missing, rootDir) {
4037
+ p.log.error(`Install reported success but ${missing.join(", ")} could not be found in ${rootDir}. Your package manager may have silently failed to write to node_modules - check its logs and try again.`);
4038
+ process.exit(1);
4039
+ }
4019
4040
  function outputKeysToTargets(keys) {
4020
4041
  const map = {
4021
4042
  loader: "loader-bundle",
@@ -4092,6 +4113,8 @@ async function taskInit(coreCompiler, strictConfig, loadProjectConfig) {
4092
4113
  silent: true
4093
4114
  });
4094
4115
  s2.stop("Dependencies installed");
4116
+ const missingBase = await verifyInstalled(coreDir, ["@stencil/core"]);
4117
+ if (missingBase.length > 0) failInstallVerification(missingBase, coreDir);
4095
4118
  if (selectedIntegrations.length > 0) {
4096
4119
  const s3 = p.spinner();
4097
4120
  const pkgs = selectedIntegrations.map((i) => i.package);
@@ -4101,6 +4124,8 @@ async function taskInit(coreCompiler, strictConfig, loadProjectConfig) {
4101
4124
  silent: true
4102
4125
  });
4103
4126
  s3.stop("Integrations installed");
4127
+ const missingIntegrations = await verifyInstalled(coreDir, pkgs);
4128
+ if (missingIntegrations.length > 0) failInstallVerification(missingIntegrations, coreDir);
4104
4129
  }
4105
4130
  if (selectedIntegrations.length > 0) {
4106
4131
  const discovered = await discoverPlugins(coreDir);
@@ -4165,6 +4190,8 @@ async function addCapabilities(cwd, strictConfig) {
4165
4190
  silent: true
4166
4191
  });
4167
4192
  s.stop("Dependencies installed");
4193
+ const missing = await verifyInstalled(cwd, pkgs);
4194
+ if (missing.length > 0) failInstallVerification(missing, cwd);
4168
4195
  }
4169
4196
  const allDiscovered = toInstall.length > 0 ? await discoverPlugins(cwd) : discovered;
4170
4197
  const newlyInstalledPkgs = new Set(toInstall.map((i) => i.package));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/cli",
3
- "version": "5.0.0-alpha.25",
3
+ "version": "5.0.0-alpha.26",
4
4
  "description": "CLI for Stencil - Web component compiler",
5
5
  "keywords": [
6
6
  "components",
@@ -38,19 +38,20 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@clack/prompts": "^1.5.1",
41
+ "local-pkg": "^1.2.1",
41
42
  "nypm": "^0.3.12",
42
43
  "std-env": "^3.8.0",
43
44
  "typescript": ">4.0.0 <7.0.0",
44
- "@stencil/dev-server": "5.0.0-alpha.25",
45
- "@stencil/templates": "5.0.0-alpha.25"
45
+ "@stencil/dev-server": "5.0.0-alpha.26",
46
+ "@stencil/templates": "5.0.0-alpha.26"
46
47
  },
47
48
  "devDependencies": {
48
49
  "tsdown": ">=0.21.0 <1.0.0",
49
50
  "vitest": "^4.1.7",
50
- "@stencil/core": "5.0.0-alpha.25"
51
+ "@stencil/core": "5.0.0-alpha.26"
51
52
  },
52
53
  "peerDependencies": {
53
- "@stencil/core": "^5.0.0 || 5.0.0-alpha.25"
54
+ "@stencil/core": "^5.0.0 || 5.0.0-alpha.26"
54
55
  },
55
56
  "volta": {
56
57
  "extends": "../../package.json"