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

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.
@@ -1564,7 +1564,7 @@ interface CompilerSystem {
1564
1564
  name: 'node' | 'in-memory';
1565
1565
  version: string;
1566
1566
  events?: BuildEvents;
1567
- details?: SystemDetails;
1567
+ details: SystemDetails;
1568
1568
  /**
1569
1569
  * Add a callback which will be ran when destroy() is called.
1570
1570
  */
@@ -1577,14 +1577,15 @@ interface CompilerSystem {
1577
1577
  * SYNC! Always returns a boolean, does not throw.
1578
1578
  */
1579
1579
  accessSync(p: string): boolean;
1580
- applyGlobalPatch?(fromDir: string): Promise<void>;
1581
1580
  applyPrerenderGlobalPatch?(opts: {
1582
1581
  devServerHostUrl: string;
1583
1582
  window: any;
1584
1583
  }): void;
1585
- cacheStorage?: CacheStorage;
1586
- checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
1587
- copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
1584
+ /**
1585
+ * Check npm for a newer Stencil version. Resolves a function that logs the result.
1586
+ */
1587
+ checkVersion(logger: Logger, currentVersion: string): Promise<() => void>;
1588
+ copy(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
1588
1589
  /**
1589
1590
  * Always returns a boolean if the files were copied or not. Does not throw.
1590
1591
  */
@@ -1609,7 +1610,7 @@ interface CompilerSystem {
1609
1610
  /**
1610
1611
  * Each platform has a different way to dynamically import modules.
1611
1612
  */
1612
- dynamicImport?(p: string): Promise<any>;
1613
+ dynamicImport(p: string): Promise<any>;
1613
1614
  /**
1614
1615
  * Creates the worker controller for the current system.
1615
1616
  *
@@ -1623,20 +1624,14 @@ interface CompilerSystem {
1623
1624
  * process.exit()
1624
1625
  */
1625
1626
  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
1627
  /**
1633
1628
  * Generates a sha1 digest encoded as HEX
1634
1629
  */
1635
- generateContentHash?(content: string | any, length?: number): Promise<string>;
1630
+ generateContentHash(content: string | any, length?: number): Promise<string>;
1636
1631
  /**
1637
1632
  * Generates a sha1 digest encoded as HEX from a file path
1638
1633
  */
1639
- generateFileHash?(filePath: string | any, length?: number): Promise<string>;
1634
+ generateFileHash(filePath: string | any, length?: number): Promise<string>;
1640
1635
  /**
1641
1636
  * Get the current directory.
1642
1637
  */
@@ -1645,7 +1640,6 @@ interface CompilerSystem {
1645
1640
  * The compiler's executing path.
1646
1641
  */
1647
1642
  getCompilerExecutingPath(): string;
1648
- getEnvironmentVar?(key: string): string;
1649
1643
  /**
1650
1644
  * Gets the absolute file path when for a dependency module.
1651
1645
  */
@@ -1684,11 +1678,7 @@ interface CompilerSystem {
1684
1678
  * Normalize file system path.
1685
1679
  */
1686
1680
  normalizePath(p: string): string;
1687
- onProcessInterrupt?(cb: () => void): void;
1688
- parseYarnLockFile?: (content: string) => {
1689
- type: 'success' | 'merge' | 'conflict';
1690
- object: any;
1691
- };
1681
+ onProcessInterrupt(cb: () => void): void;
1692
1682
  platformPath: PlatformPath;
1693
1683
  /**
1694
1684
  * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
@@ -1724,6 +1714,9 @@ interface CompilerSystem {
1724
1714
  * Rename old path to new path. Does not throw.
1725
1715
  */
1726
1716
  rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
1717
+ /**
1718
+ * Assigned by the compiler. Used by plugins (e.g. `@stencil/sass`) to resolve `~` imports.
1719
+ */
1727
1720
  resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
1728
1721
  resolvePath(p: string): string;
1729
1722
  /**
@@ -2363,7 +2356,7 @@ interface OutputTargetCollection extends OutputTargetBaseNext {
2363
2356
  * When `true` this flag will transform aliased import paths defined in
2364
2357
  * a project's `tsconfig.json` to relative import paths in the compiled output.
2365
2358
  *
2366
- * Paths will be left in aliased format if `false` or `undefined`.
2359
+ * Paths will be left in aliased format if `false`. Defaults to `true`.
2367
2360
  *
2368
2361
  * @example
2369
2362
  * // tsconfig.json
@@ -2465,11 +2458,11 @@ interface OutputTargetGlobalStyle extends OutputTargetBaseNext {
2465
2458
  * Controls whether this global stylesheet is injected into component shadow DOMs
2466
2459
  * as a constructable stylesheet at runtime.
2467
2460
  *
2468
- * - `'none'` (default): Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
2461
+ * - `'none'`: Don't inject - stylesheet must be loaded externally (e.g., via `<link>`)
2469
2462
  * - `'client'`: Inject only in client builds, not SSR (reduces SSR output size)
2470
2463
  * - `'all'`: Inject in both client and SSR builds
2471
2464
  *
2472
- * @default 'none'
2465
+ * @default 'client' when the stylesheet comes from `globalStyle` (or an auto-detected `src/global.*`), 'none' when `input` is set
2473
2466
  */
2474
2467
  inject?: 'none' | 'client' | 'all';
2475
2468
  }
@@ -2668,7 +2661,7 @@ interface OutputTargetDocsAgentSkill extends OutputTargetBase {
2668
2661
  /**
2669
2662
  * The skill's name, used in the `SKILL.md` frontmatter.
2670
2663
  *
2671
- * Defaults to a kebab-cased form of {@link Config.namespace}.
2664
+ * Defaults to {@link Config.namespace}, lowercased, with anything other than letters and numbers replaced by `-`.
2672
2665
  */
2673
2666
  name?: string;
2674
2667
  /**
@@ -2796,8 +2789,10 @@ interface OutputTargetBase {
2796
2789
  * This improves dev build times by not generating production-only artifacts.
2797
2790
  *
2798
2791
  * Defaults vary by output target type:
2799
- * - `loader-bundle`: `false` (always builds)
2800
- * - `standalone`: `true` (skips in dev)
2792
+ * - `loader-bundle`: `true` (skips the npm distribution files; the browser bundle always builds)
2793
+ * - `standalone`: `true` if `loader-bundle` is also configured, otherwise `false`
2794
+ * - `types`, `collection`, `ssr-wasm`: `true` (skips in dev)
2795
+ * - `assets`, `global-style`: `false` (always runs)
2801
2796
  * - `ssr`: `true` (skips in dev, unless `devServer.ssr` is enabled)
2802
2797
  * - `docs-*`: `true` (skips in dev)
2803
2798
  * - `custom`: `true` (skips in dev)
@@ -2967,10 +2962,6 @@ interface Diagnostic {
2967
2962
  relFilePath?: string | undefined;
2968
2963
  type: string;
2969
2964
  }
2970
- interface CacheStorage {
2971
- get(key: string): Promise<any>;
2972
- set(key: string, value: any): Promise<void>;
2973
- }
2974
2965
  /**
2975
2966
  * Input for CSS optimization functions, including the input CSS
2976
2967
  * 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.15";
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.15",
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/mock-doc": "5.0.0-beta.15",
130
+ "@stencil/cli": "5.0.0-beta.15",
131
+ "@stencil/dev-server": "5.0.0-beta.15"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",