@stencil/core 5.0.0-beta.14 → 5.0.0-beta.16

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.
@@ -942,8 +942,7 @@ interface StencilConfig {
942
942
  * Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
943
943
  * for each component in the build when `true`.
944
944
  *
945
- * Defaults to `true` for "no-config" projects (no `stencil.config.ts`/`.js` file), and `false`
946
- * whenever a config file is present - set this explicitly to opt an existing project in or out.
945
+ * @default false
947
946
  */
948
947
  generateExportMaps?: boolean;
949
948
  /**
@@ -1564,7 +1563,7 @@ interface CompilerSystem {
1564
1563
  name: 'node' | 'in-memory';
1565
1564
  version: string;
1566
1565
  events?: BuildEvents;
1567
- details?: SystemDetails;
1566
+ details: SystemDetails;
1568
1567
  /**
1569
1568
  * Add a callback which will be ran when destroy() is called.
1570
1569
  */
@@ -1577,14 +1576,15 @@ interface CompilerSystem {
1577
1576
  * SYNC! Always returns a boolean, does not throw.
1578
1577
  */
1579
1578
  accessSync(p: string): boolean;
1580
- applyGlobalPatch?(fromDir: string): Promise<void>;
1581
1579
  applyPrerenderGlobalPatch?(opts: {
1582
1580
  devServerHostUrl: string;
1583
1581
  window: any;
1584
1582
  }): void;
1585
- cacheStorage?: CacheStorage;
1586
- checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
1587
- copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
1583
+ /**
1584
+ * Check npm for a newer Stencil version. Resolves a function that logs the result.
1585
+ */
1586
+ checkVersion(logger: Logger, currentVersion: string): Promise<() => void>;
1587
+ copy(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
1588
1588
  /**
1589
1589
  * Always returns a boolean if the files were copied or not. Does not throw.
1590
1590
  */
@@ -1609,7 +1609,7 @@ interface CompilerSystem {
1609
1609
  /**
1610
1610
  * Each platform has a different way to dynamically import modules.
1611
1611
  */
1612
- dynamicImport?(p: string): Promise<any>;
1612
+ dynamicImport(p: string): Promise<any>;
1613
1613
  /**
1614
1614
  * Creates the worker controller for the current system.
1615
1615
  *
@@ -1623,20 +1623,14 @@ interface CompilerSystem {
1623
1623
  * process.exit()
1624
1624
  */
1625
1625
  exit(exitCode: number): Promise<void>;
1626
- /**
1627
- * Optionally provide a fetch() function rather than using the built-in fetch().
1628
- * First arg is a url string or Request object (RequestInfo).
1629
- * Second arg is the RequestInit. Returns the Response object
1630
- */
1631
- fetch?(input: string | any, init?: any): Promise<any>;
1632
1626
  /**
1633
1627
  * Generates a sha1 digest encoded as HEX
1634
1628
  */
1635
- generateContentHash?(content: string | any, length?: number): Promise<string>;
1629
+ generateContentHash(content: string | any, length?: number): Promise<string>;
1636
1630
  /**
1637
1631
  * Generates a sha1 digest encoded as HEX from a file path
1638
1632
  */
1639
- generateFileHash?(filePath: string | any, length?: number): Promise<string>;
1633
+ generateFileHash(filePath: string | any, length?: number): Promise<string>;
1640
1634
  /**
1641
1635
  * Get the current directory.
1642
1636
  */
@@ -1645,7 +1639,6 @@ interface CompilerSystem {
1645
1639
  * The compiler's executing path.
1646
1640
  */
1647
1641
  getCompilerExecutingPath(): string;
1648
- getEnvironmentVar?(key: string): string;
1649
1642
  /**
1650
1643
  * Gets the absolute file path when for a dependency module.
1651
1644
  */
@@ -1684,11 +1677,7 @@ interface CompilerSystem {
1684
1677
  * Normalize file system path.
1685
1678
  */
1686
1679
  normalizePath(p: string): string;
1687
- onProcessInterrupt?(cb: () => void): void;
1688
- parseYarnLockFile?: (content: string) => {
1689
- type: 'success' | 'merge' | 'conflict';
1690
- object: any;
1691
- };
1680
+ onProcessInterrupt(cb: () => void): void;
1692
1681
  platformPath: PlatformPath;
1693
1682
  /**
1694
1683
  * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
@@ -1724,6 +1713,9 @@ interface CompilerSystem {
1724
1713
  * Rename old path to new path. Does not throw.
1725
1714
  */
1726
1715
  rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
1716
+ /**
1717
+ * Assigned by the compiler. Used by plugins (e.g. `@stencil/sass`) to resolve `~` imports.
1718
+ */
1727
1719
  resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
1728
1720
  resolvePath(p: string): string;
1729
1721
  /**
@@ -2363,7 +2355,7 @@ interface OutputTargetCollection extends OutputTargetBaseNext {
2363
2355
  * When `true` this flag will transform aliased import paths defined in
2364
2356
  * a project's `tsconfig.json` to relative import paths in the compiled output.
2365
2357
  *
2366
- * Paths will be left in aliased format if `false` or `undefined`.
2358
+ * Paths will be left in aliased format if `false`. Defaults to `true`.
2367
2359
  *
2368
2360
  * @example
2369
2361
  * // tsconfig.json
@@ -2465,11 +2457,11 @@ interface OutputTargetGlobalStyle extends OutputTargetBaseNext {
2465
2457
  * Controls whether this global stylesheet is injected into component shadow DOMs
2466
2458
  * as a constructable stylesheet at runtime.
2467
2459
  *
2468
- * - `'none'` (default): Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
2460
+ * - `'none'`: Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
2469
2461
  * - `'client'`: Inject only in client builds, not SSR (reduces SSR output size)
2470
2462
  * - `'all'`: Inject in both client and SSR builds
2471
2463
  *
2472
- * @default 'none'
2464
+ * @default 'client' when the stylesheet comes from `globalStyle` (or an auto-detected `src/global.*`), 'none' when `input` is set
2473
2465
  */
2474
2466
  inject?: 'none' | 'client' | 'all';
2475
2467
  }
@@ -2668,7 +2660,7 @@ interface OutputTargetDocsAgentSkill extends OutputTargetBase {
2668
2660
  /**
2669
2661
  * The skill's name, used in the `SKILL.md` frontmatter.
2670
2662
  *
2671
- * Defaults to a kebab-cased form of {@link Config.namespace}.
2663
+ * Defaults to {@link Config.namespace}, lowercased, with anything other than letters and numbers replaced by `-`.
2672
2664
  */
2673
2665
  name?: string;
2674
2666
  /**
@@ -2796,8 +2788,10 @@ interface OutputTargetBase {
2796
2788
  * This improves dev build times by not generating production-only artifacts.
2797
2789
  *
2798
2790
  * Defaults vary by output target type:
2799
- * - `loader-bundle`: `false` (always builds)
2800
- * - `standalone`: `true` (skips in dev)
2791
+ * - `loader-bundle`: `true` (skips the npm distribution files; the browser bundle always builds)
2792
+ * - `standalone`: `true` if `loader-bundle` is also configured, otherwise `false`
2793
+ * - `types`, `collection`, `ssr-wasm`: `true` (skips in dev)
2794
+ * - `assets`, `global-style`: `false` (always runs)
2801
2795
  * - `ssr`: `true` (skips in dev, unless `devServer.ssr` is enabled)
2802
2796
  * - `docs-*`: `true` (skips in dev)
2803
2797
  * - `custom`: `true` (skips in dev)
@@ -2967,10 +2961,6 @@ interface Diagnostic {
2967
2961
  relFilePath?: string | undefined;
2968
2962
  type: string;
2969
2963
  }
2970
- interface CacheStorage {
2971
- get(key: string): Promise<any>;
2972
- set(key: string, value: any): Promise<void>;
2973
- }
2974
2964
  /**
2975
2965
  * Input for CSS optimization functions, including the input CSS
2976
2966
  * string and a few boolean options which turn on or off various
@@ -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-beta.14";
36
+ const version = "5.0.0-beta.16";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
@@ -380,6 +380,10 @@ const trimFalsy = (data) => {
380
380
  */
381
381
  const isDef = (v) => v != null && v !== void 0;
382
382
  /**
383
+ * This is just a no-op, don't expect it to do anything.
384
+ */
385
+ const noop = () => {};
386
+ /**
383
387
  * Check whether a value is a 'complex type', defined here as an object or a
384
388
  * function.
385
389
  *
@@ -3626,9 +3630,7 @@ const h = (nodeName, vnodeData, ...children) => {
3626
3630
  if (classData && !(BUILD.vdomSignals && isSignalLike(classData))) vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
3627
3631
  }
3628
3632
  }
3629
- if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be the single root component. Make sure:
3630
- - You are NOT using hostData() and <Host> in the same component.
3631
- - <Host> is used once, and it's the single root component of the render() function.`);
3633
+ if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be used once, and be the single root component of the render() function.`);
3632
3634
  if (BUILD.vdomFunctional && typeof nodeName === "function") return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
3633
3635
  const vnode = newVNode(nodeName, null);
3634
3636
  vnode.$attrs$ = vnodeData;
@@ -7408,15 +7410,6 @@ const createSystem = (c) => {
7408
7410
  }
7409
7411
  return results;
7410
7412
  };
7411
- /**
7412
- * `self` is the global namespace object used within a web worker.
7413
- * `window` is the browser's global namespace object (I reorganized this to check the reference on that second)
7414
- * `global` is Node's global namespace object. https://nodejs.org/api/globals.html#globals_global
7415
- *
7416
- * loading in this order should allow workers, which are most common, then browser,
7417
- * then Node to grab the reference to fetch correctly.
7418
- */
7419
- const fetch = typeof self !== "undefined" ? self?.fetch : typeof window !== "undefined" ? window?.fetch : typeof global !== "undefined" ? global?.fetch : void 0;
7420
7413
  const writeFile = async (p, data) => writeFileSync(p, data);
7421
7414
  const tmpDirSync = () => "/.tmp";
7422
7415
  const tick = Promise.resolve();
@@ -7427,6 +7420,7 @@ const createSystem = (c) => {
7427
7420
  if (typeof hashLength === "number") hashHex = hashHex.slice(0, hashLength);
7428
7421
  return hashHex;
7429
7422
  };
7423
+ const generateFileHash = async (filePath, hashLength) => generateContentHash(readFileSync(filePath), hashLength);
7430
7424
  const copy = async (copyTasks, srcDir) => {
7431
7425
  const results = {
7432
7426
  diagnostics: [],
@@ -7436,9 +7430,6 @@ const createSystem = (c) => {
7436
7430
  logger.info("todo, copy task", copyTasks.length, srcDir);
7437
7431
  return results;
7438
7432
  };
7439
- const getEnvironmentVar = (key) => {
7440
- return process$1?.env[key];
7441
- };
7442
7433
  const getLocalModulePath = (opts) => join(opts.rootDir, "node_modules", opts.moduleId, opts.path);
7443
7434
  const getRemoteModuleUrl = (opts) => {
7444
7435
  const npmBaseUrl = "https://cdn.jsdelivr.net/npm/";
@@ -7454,13 +7445,14 @@ const createSystem = (c) => {
7454
7445
  access,
7455
7446
  accessSync,
7456
7447
  addDestroy,
7448
+ checkVersion: async () => noop,
7457
7449
  copyFile,
7458
7450
  createDir,
7459
7451
  createDirSync,
7460
7452
  homeDir,
7461
7453
  isTTY,
7462
- getEnvironmentVar,
7463
7454
  destroy,
7455
+ dynamicImport: (p) => import(p),
7464
7456
  encodeToBase64,
7465
7457
  exit: async (exitCode) => logger.warn(`exit ${exitCode}`),
7466
7458
  getCurrentDirectory,
@@ -7471,6 +7463,7 @@ const createSystem = (c) => {
7471
7463
  isSymbolicLink,
7472
7464
  nextTick,
7473
7465
  normalizePath: normalize,
7466
+ onProcessInterrupt: noop,
7474
7467
  platformPath: path,
7475
7468
  readDir,
7476
7469
  readDirSync,
@@ -7480,7 +7473,6 @@ const createSystem = (c) => {
7480
7473
  realpathSync,
7481
7474
  removeDestroy,
7482
7475
  rename,
7483
- fetch,
7484
7476
  resolvePath,
7485
7477
  removeDir,
7486
7478
  removeDirSync,
@@ -7495,6 +7487,7 @@ const createSystem = (c) => {
7495
7487
  writeFile,
7496
7488
  writeFileSync,
7497
7489
  generateContentHash,
7490
+ generateFileHash,
7498
7491
  createWorkerController: null,
7499
7492
  details: {
7500
7493
  cpuModel: "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.14",
3
+ "version": "5.0.0-beta.16",
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-beta.14",
130
- "@stencil/dev-server": "5.0.0-beta.14",
131
- "@stencil/mock-doc": "5.0.0-beta.14"
129
+ "@stencil/dev-server": "5.0.0-beta.16",
130
+ "@stencil/cli": "5.0.0-beta.16",
131
+ "@stencil/mock-doc": "5.0.0-beta.16"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",