@stencil/core 5.0.0-beta.6 → 5.0.0-beta.7

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.
@@ -1832,7 +1832,7 @@ const validateComponentTag = (tag) => {
1832
1832
  };
1833
1833
  //#endregion
1834
1834
  //#region src/version.ts
1835
- const version = "5.0.0-beta.6";
1835
+ const version = "5.0.0-beta.7";
1836
1836
  //#endregion
1837
1837
  //#region src/compiler/events.ts
1838
1838
  const buildEvents = () => {
@@ -1,3 +1,3 @@
1
- import { _ as buildId, a as createPrerenderer, b as versions, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as getScopeId, h as cmpMetaToDocsComponent, i as createSystem, l as createWorkerMessageHandler, m as generateManifest, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as vermoji, x as scopeCss, y as version } from "../compiler-D61AKA0g.mjs";
1
+ import { _ as buildId, a as createPrerenderer, b as versions, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as getScopeId, h as cmpMetaToDocsComponent, i as createSystem, l as createWorkerMessageHandler, m as generateManifest, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as vermoji, x as scopeCss, y as version } from "../compiler-K2S5pO1u.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-75gQKkFz.mjs";
3
3
  export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, generateManifest, getScopeId, loadConfig, nodeRequire, optimizeCss, optimizeJs, scopeCss, transpile, transpileSync, ts, validateConfig, vermoji, version, versions };
@@ -461,9 +461,9 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
461
461
  };
462
462
  //#endregion
463
463
  //#region src/version.ts
464
- const version = "5.0.0-beta.6";
465
- const buildId = "1788947454";
466
- const vermoji = "🔈";
464
+ const version = "5.0.0-beta.7";
465
+ const buildId = "1788951557";
466
+ const vermoji = "🐬";
467
467
  /**
468
468
  * Get the installed version of a tool/dependency.
469
469
  * Handles packages with exports maps that point to subdirectories.
@@ -18148,6 +18148,31 @@ const getPackageJsonRecommendations = (config, compilerCtx) => {
18148
18148
  };
18149
18149
  };
18150
18150
  /**
18151
+ * Collect the rootDir-relative directories of every configured output target that must
18152
+ * ship in the published npm package for consumers (and their tooling) to be able to use
18153
+ * it - as opposed to dev-only artifacts like `www`.
18154
+ * @param config The validated Stencil configuration
18155
+ * @param buildCtx The build context (used to check whether there are actually component
18156
+ * assets to copy - the `assets` output target is otherwise a no-op and its directory is
18157
+ * never written)
18158
+ * @returns a de-duplicated list of rootDir-relative directory paths
18159
+ */
18160
+ const getDistributableOutputDirs = (config, buildCtx) => {
18161
+ const loaderBundle = config.outputTargets.find(isOutputTargetLoaderBundle);
18162
+ const standalone = config.outputTargets.find(isOutputTargetStandalone);
18163
+ const types = config.outputTargets.find(isOutputTargetTypes);
18164
+ const collections = config.outputTargets.filter(isOutputTargetCollection);
18165
+ const assets = buildCtx.components.some((cmp) => cmp.assetsDirs != null && cmp.assetsDirs.length > 0) ? config.outputTargets.find(isOutputTargetAssets) : void 0;
18166
+ const dirs = [
18167
+ loaderBundle?.dir,
18168
+ standalone?.dir,
18169
+ types?.dir,
18170
+ assets?.dir,
18171
+ ...collections.map((c) => c.dir)
18172
+ ].filter((dir) => !!dir).map((dir) => normalizePath(relative$1(config.rootDir, dir)));
18173
+ return Array.from(new Set(dirs));
18174
+ };
18175
+ /**
18151
18176
  * Validate the package.json file for a project, checking that various fields
18152
18177
  * are set correctly for the currently-configured output targets.
18153
18178
  *
@@ -18161,8 +18186,8 @@ const getPackageJsonRecommendations = (config, compilerCtx) => {
18161
18186
  const validateBuildPackageJson = async (config, compilerCtx, buildCtx) => {
18162
18187
  if (config.watch || config.devMode || buildCtx.packageJson == null) return;
18163
18188
  validatePackageJson(config, compilerCtx, buildCtx);
18164
- const stencilCollectionOutputTargets = config.outputTargets.filter(isOutputTargetCollection);
18165
- await Promise.all(stencilCollectionOutputTargets.map((stencilCollectionOT) => validateCollectionFields(config, compilerCtx, buildCtx, stencilCollectionOT)));
18189
+ await validateFilesField(config, compilerCtx, buildCtx);
18190
+ config.outputTargets.filter(isOutputTargetCollection).forEach((stencilCollectionOT) => validateCollectionField(config, compilerCtx, buildCtx, stencilCollectionOT));
18166
18191
  };
18167
18192
  /**
18168
18193
  * Validates a project's package.json fields against recommended values
@@ -18280,47 +18305,49 @@ const validateTypeField = (config, compilerCtx, buildCtx, recommendations) => {
18280
18305
  if (recommendations.moduleOptions.length > 0 && currentType !== "module") packageJsonWarn(config, compilerCtx, buildCtx, `package.json "type" property should be set to "module".`, "\"type\"");
18281
18306
  };
18282
18307
  /**
18283
- * Validate package.json contents specific to the `collection` output target,
18284
- * checking that the `files` array and `collection` field are set correctly.
18285
- * @param config the Stencil configuration associated with the project being compiled
18286
- * @param compilerCtx the current compiler context
18287
- * @param buildCtx the context associated with the current build
18288
- * @param outputTarget the collection output target to validate against
18308
+ * Check if a rootDir-relative directory is covered by a package.json `files` array,
18309
+ * either directly or via a parent directory entry (e.g. "dist/" covers "dist/types/").
18310
+ * @param files the package.json "files" array
18311
+ * @param dir the rootDir-relative directory to check for
18312
+ * @returns true if `dir` is covered by one of the `files` entries
18289
18313
  */
18290
- const validateCollectionFields = async (config, compilerCtx, buildCtx, outputTarget) => {
18291
- await Promise.all([validatePackageFiles(config, compilerCtx, buildCtx, outputTarget), validateCollectionField(config, compilerCtx, buildCtx, outputTarget)]);
18314
+ const isDirCoveredByFiles = (files, dir) => {
18315
+ const normalizedDir = dir.replace(/\/$/, "").replace(/^\.\//, "");
18316
+ return files.some((userPath) => {
18317
+ const normalizedUserPath = normalizePath(userPath).replace(/\/$/, "").replace(/^\.\//, "");
18318
+ if (normalizedUserPath === normalizedDir) return true;
18319
+ const userPathWithSlash = normalizedUserPath + "/";
18320
+ return normalizedDir.startsWith(userPathWithSlash);
18321
+ });
18292
18322
  };
18293
18323
  /**
18294
- * Validate that the `files` field in `package.json` contains directories and
18295
- * files that are necessary for the `collection` output target.
18324
+ * Validate that the `files` field in `package.json` covers every distributable output
18325
+ * directory (loader-bundle, standalone, types, collection) - not just one of them -
18326
+ * since `npm publish` needs all of them to produce a working package for consumers.
18296
18327
  * @param config the Stencil configuration associated with the project being compiled
18297
18328
  * @param compilerCtx the current compiler context
18298
18329
  * @param buildCtx the context associated with the current build
18299
- * @param outputTarget the collection output target to validate against
18300
18330
  */
18301
- const validatePackageFiles = async (config, compilerCtx, buildCtx, outputTarget) => {
18302
- const actualDistDir = normalizePath(relative$1(config.rootDir, outputTarget.dir));
18331
+ const validateFilesField = async (config, compilerCtx, buildCtx) => {
18332
+ const distDirs = getDistributableOutputDirs(config, buildCtx);
18333
+ if (distDirs.length === 0) return;
18334
+ const formatDirs = (dirs) => dirs.map((dir) => `"${dir}/"`).join(", ");
18303
18335
  if (!Array.isArray(buildCtx.packageJson.files)) {
18304
18336
  const npmignorePath = join$2(dirname$1(config.packageJsonFilePath), ".npmignore");
18305
18337
  if (!await compilerCtx.fs.access(npmignorePath)) {
18306
- const msg = `package.json is missing a "files" array. Without one, "npm publish" falls back to ".gitignore" to decide what to include, which will likely exclude the distribution directory "${actualDistDir}/". Add "files": ["${actualDistDir}/"] to package.json (or add a ".npmignore").`;
18338
+ const msg = `package.json is missing a "files" array. Without one, "npm publish" falls back to ".gitignore" to decide what to include, which will likely exclude ${distDirs.length > 1 ? "the distribution directories" : "the distribution directory"} ${formatDirs(distDirs)}. Add a "files" array covering ${distDirs.length > 1 ? "them" : "it"} to package.json (or add a ".npmignore").`;
18307
18339
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"files"`);
18308
18340
  }
18309
18341
  return;
18310
18342
  }
18311
- if (!buildCtx.packageJson.files.some((userPath) => {
18312
- const normalizedUserPath = normalizePath(userPath).replace(/\/$/, "").replace(/^\.\//, "");
18313
- const normalizedDistDir = actualDistDir.replace(/\/$/, "").replace(/^\.\//, "");
18314
- if (normalizedUserPath === normalizedDistDir) return true;
18315
- const userPathWithSlash = normalizedUserPath + "/";
18316
- if (normalizedDistDir.startsWith(userPathWithSlash)) return true;
18317
- return false;
18318
- })) {
18319
- const msg = `package.json "files" array must contain the distribution directory "${actualDistDir}/" when generating a distribution.`;
18343
+ const files = buildCtx.packageJson.files;
18344
+ const uncoveredDirs = distDirs.filter((dir) => !isDirCoveredByFiles(files, dir));
18345
+ if (uncoveredDirs.length > 0) {
18346
+ const msg = `package.json "files" array must contain the distribution ${uncoveredDirs.length > 1 ? "directories" : "directory"} ${formatDirs(uncoveredDirs)} when generating a distribution.`;
18320
18347
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"files"`);
18321
18348
  return;
18322
18349
  }
18323
- await Promise.all(buildCtx.packageJson.files.map(async (pkgFile) => {
18350
+ await Promise.all(files.map(async (pkgFile) => {
18324
18351
  if (!isGlob(pkgFile)) {
18325
18352
  const packageJsonDir = dirname$1(config.packageJsonFilePath);
18326
18353
  const absPath = join$2(packageJsonDir, pkgFile);
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-D61AKA0g.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-K2S5pO1u.mjs";
2
2
  import { t as createNodeSys } from "../../node-75gQKkFz.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
@@ -32,7 +32,7 @@ import "@rollup/pluginutils";
32
32
  import { createHash } from "crypto";
33
33
  import { afterAll, vi } from "vitest";
34
34
  //#region src/version.ts
35
- const version = "5.0.0-beta.6";
35
+ const version = "5.0.0-beta.7";
36
36
  const MEMBER_FLAGS = {
37
37
  String: 1,
38
38
  Number: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.6",
3
+ "version": "5.0.0-beta.7",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -125,9 +125,9 @@
125
125
  "terser": "^5.50.0",
126
126
  "tinyglobby": "^0.2.17",
127
127
  "typescript": ">5.0.0 <7.0.0",
128
- "@stencil/cli": "5.0.0-beta.6",
129
- "@stencil/mock-doc": "5.0.0-beta.6",
130
- "@stencil/dev-server": "5.0.0-beta.6"
128
+ "@stencil/cli": "5.0.0-beta.7",
129
+ "@stencil/mock-doc": "5.0.0-beta.7",
130
+ "@stencil/dev-server": "5.0.0-beta.7"
131
131
  },
132
132
  "devDependencies": {
133
133
  "@ionic/prettier-config": "^4.0.0",