@stencil/core 5.0.0-rc.5 → 5.0.0-rc.6

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.
@@ -1845,7 +1845,7 @@ const validateComponentTag = (tag) => {
1845
1845
  };
1846
1846
  //#endregion
1847
1847
  //#region src/version.ts
1848
- const version = "5.0.0-rc.5";
1848
+ const version = "5.0.0-rc.6";
1849
1849
  //#endregion
1850
1850
  //#region src/compiler/events.ts
1851
1851
  const buildEvents = () => {
@@ -1,3 +1,3 @@
1
- import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-CxfLkFCX.mjs";
1
+ import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-BBM6aOyJ.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bsfi3pOs.mjs";
3
3
  export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, 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-rc.5";
465
- const buildId = "1795169814";
466
- const vermoji = "🗻";
464
+ const version = "5.0.0-rc.6";
465
+ const buildId = "1795174424";
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.
@@ -2065,28 +2065,40 @@ const scanFiles = async (config, compilerCtx, buildCtx, cache, filePaths) => {
2065
2065
  }));
2066
2066
  };
2067
2067
  /**
2068
- * Load a CSS-only component source file's text. A plain `.css` file is read as-is; any other
2069
- * `STYLE_EXT` extension is run through the configured `plugins` first (e.g. `@stencil/sass`
2070
- * compiling `.scss` to CSS) - the same pipeline `collectCssOnlyComponentStyles` uses to emit
2071
- * this file's CSS, so discovery parses exactly what gets shipped.
2068
+ * Load a CSS-only component source file's text. Only files whose raw source contains
2069
+ * `@component` are considered - a definition belongs to the file that literally contains it,
2070
+ * so preprocessor partials and importers are never compiled standalone here. A plain `.css`
2071
+ * file is returned as-is; any other `STYLE_EXT` extension is run through the configured
2072
+ * `plugins` first (e.g. `@stencil/sass` compiling `.scss` to CSS) - the same pipeline
2073
+ * `collectCssOnlyComponentStyles` uses to emit this file's CSS, so discovery parses exactly
2074
+ * what gets shipped.
2072
2075
  *
2073
2076
  * @param config the validated Stencil config
2074
2077
  * @param compilerCtx the compiler context, used to read the file and register watch files
2075
2078
  * @param buildCtx the current build context, used for plugin transform diagnostics
2076
2079
  * @param filePath absolute path to the source file to load
2077
- * @returns the (possibly preprocessed) CSS text, or `null` if the file couldn't be loaded
2080
+ * @returns the (possibly preprocessed) CSS text, or `null` if the file couldn't be loaded or
2081
+ * has no `@component` marker
2078
2082
  */
2079
2083
  const loadCssOnlyComponentSource = async (config, compilerCtx, buildCtx, filePath) => {
2080
- if (filePath.toLowerCase().endsWith(".css")) try {
2081
- return await compilerCtx.fs.readFile(filePath);
2084
+ let rawText;
2085
+ try {
2086
+ rawText = await compilerCtx.fs.readFile(filePath);
2082
2087
  } catch {
2083
2088
  return null;
2084
2089
  }
2090
+ if (!rawText.includes("@component")) return null;
2091
+ if (filePath.toLowerCase().endsWith(".css")) return rawText;
2085
2092
  const transformResults = await runPluginTransforms(config, compilerCtx, buildCtx, filePath);
2086
2093
  if (!transformResults) return null;
2087
- if (typeof transformResults === "string") return transformResults;
2088
- for (const dep of transformResults.dependencies ?? []) compilerCtx.addWatchFile(dep);
2089
- return transformResults.code ?? null;
2094
+ const code = typeof transformResults === "string" ? transformResults : transformResults.code;
2095
+ if (typeof transformResults !== "string") for (const dep of transformResults.dependencies ?? []) compilerCtx.addWatchFile(dep);
2096
+ if (code != null && !code.includes("@component")) {
2097
+ const warn = buildWarn(buildCtx.diagnostics);
2098
+ warn.messageText = `"${relative$1(config.rootDir, filePath)}" contains "@component" but its preprocessed output does not, so no CSS-only components were discovered in it. Is the preprocessor stripping comments (e.g. sass \`outputStyle: 'compressed'\`)?`;
2099
+ warn.absFilePath = filePath;
2100
+ }
2101
+ return code ?? null;
2090
2102
  };
2091
2103
  const flattenCache = (cache) => Array.from(cache.values()).flat();
2092
2104
  /**
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-CxfLkFCX.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-BBM6aOyJ.mjs";
2
2
  import { t as createNodeSys } from "../../node-Bsfi3pOs.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
33
33
  import { createHash } from "crypto";
34
34
  import { afterAll, vi } from "vitest";
35
35
  //#region src/version.ts
36
- const version = "5.0.0-rc.5";
36
+ const version = "5.0.0-rc.6";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-rc.5",
3
+ "version": "5.0.0-rc.6",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -126,9 +126,9 @@
126
126
  "terser": "^5.50.0",
127
127
  "tinyglobby": "^0.2.17",
128
128
  "typescript": ">5.0.0 <7.0.0",
129
- "@stencil/cli": "5.0.0-rc.5",
130
- "@stencil/dev-server": "5.0.0-rc.5",
131
- "@stencil/mock-doc": "5.0.0-rc.5"
129
+ "@stencil/cli": "5.0.0-rc.6",
130
+ "@stencil/mock-doc": "5.0.0-rc.6",
131
+ "@stencil/dev-server": "5.0.0-rc.6"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",