@stencil/core 5.0.0-beta.3 → 5.0.0-beta.30

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 (36) hide show
  1. package/dist/app-data/index.d.ts +1 -1
  2. package/dist/{client-BRu0GtRn.mjs → client-BYvfR_Hx.mjs} +127 -68
  3. package/dist/compiler/browser.d.ts +114 -81
  4. package/dist/compiler/browser.js +733 -336
  5. package/dist/compiler/index.d.mts +110 -2
  6. package/dist/compiler/index.mjs +3 -3
  7. package/dist/compiler/utils/index.d.mts +1 -1
  8. package/dist/{compiler-BPgV6bA4.mjs → compiler-6RhuOkQ0.mjs} +4829 -2895
  9. package/dist/declarations/stencil-public-compiler.d.ts +152 -129
  10. package/dist/declarations/stencil-public-docs.d.ts +23 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +60 -58
  12. package/dist/{index-DmHmu3y0.d.mts → index-BGUOG9Wc.d.mts} +6 -2
  13. package/dist/{index-BXAcVN2j.d.ts → index-BHciXst1.d.ts} +57 -55
  14. package/dist/{index-BopBfjPu.d.mts → index-BogZpjP2.d.mts} +150 -127
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.mjs +1 -1
  17. package/dist/jsx-runtime.d.mts +6 -0
  18. package/dist/jsx-runtime.mjs +1 -1
  19. package/dist/{node-75gQKkFz.mjs → node-CvPPhnWO.mjs} +41 -47
  20. package/dist/runtime/client/lazy.js +252 -189
  21. package/dist/runtime/client/runtime.d.ts +71 -66
  22. package/dist/runtime/client/runtime.js +252 -189
  23. package/dist/runtime/index.d.ts +4 -5
  24. package/dist/runtime/index.js +250 -187
  25. package/dist/runtime/server/index.d.mts +11 -11
  26. package/dist/runtime/server/index.mjs +302 -228
  27. package/dist/runtime/server/runner.d.mts +4 -4
  28. package/dist/runtime/server/runner.mjs +82 -54
  29. package/dist/signals/index.d.ts +11 -2
  30. package/dist/signals/index.js +14 -35
  31. package/dist/sys/node/index.d.mts +1 -1
  32. package/dist/sys/node/index.mjs +1 -1
  33. package/dist/sys/node/worker.mjs +2 -2
  34. package/dist/testing/index.d.mts +136 -120
  35. package/dist/testing/index.mjs +259 -201
  36. package/package.json +8 -4
@@ -1,3 +1,3 @@
1
- import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BRu0GtRn.mjs";
1
+ import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BYvfR_Hx.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  export { Fragment, jsx, jsxDEV, jsxs };
@@ -1,12 +1,12 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./client-BRu0GtRn.mjs";
2
+ import "./client-BYvfR_Hx.mjs";
3
3
  import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
4
4
  import { $ as catchError, K as normalizePath, X as buildError, Y as TASK_CANCELED_MSG, nt as shouldIgnoreError, rt as isGlob } from "./util-IKfWWLJo.mjs";
5
5
  import fs from "node:fs";
6
6
  import nodePath from "node:path";
7
7
  import { pathToFileURL } from "node:url";
8
+ import picomatch from "picomatch";
8
9
  import path from "path";
9
- import * as cp from "child_process";
10
10
  import chalk from "chalk";
11
11
  import { createHash } from "node:crypto";
12
12
  import * as os from "node:os";
@@ -20,6 +20,7 @@ import satisfies from "semver/functions/satisfies.js";
20
20
  import { cpus as cpus$1, tmpdir as tmpdir$1 } from "os";
21
21
  import semverLt from "semver/functions/lt.js";
22
22
  import { EventEmitter } from "events";
23
+ import * as cp from "child_process";
23
24
  //#region src/compiler/events.ts
24
25
  const buildEvents = () => {
25
26
  const evCallbacks = [];
@@ -766,7 +767,13 @@ async function nodeCopyTasks(copyTasks, srcDir) {
766
767
  filePaths: []
767
768
  };
768
769
  try {
769
- copyTasks = flatOne(await Promise.all(copyTasks.map((task) => processGlobs(task, srcDir))));
770
+ copyTasks = flatOne(await Promise.all(copyTasks.map(async (task) => {
771
+ const fileTasks = await processGlobs(task, srcDir);
772
+ if (!fileTasks.some(escapesDest)) return fileTasks;
773
+ const err = buildError(results.diagnostics);
774
+ err.messageText = `Copy task "${task.src}" would write outside its destination "${task.dest}". Set "dest" (without "keepDirStructure") when copying from outside the src directory.`;
775
+ return [];
776
+ })));
770
777
  const allCopyTasks = [];
771
778
  while (copyTasks.length > 0) {
772
779
  const tasks = copyTasks.splice(0, 100);
@@ -791,9 +798,21 @@ async function processGlobs(copyTask, srcDir) {
791
798
  dest: copyTask.keepDirStructure ? path.join(copyTask.dest, copyTask.src) : copyTask.dest,
792
799
  warn: copyTask.warn,
793
800
  ignore: copyTask.ignore,
794
- keepDirStructure: copyTask.keepDirStructure
801
+ keepDirStructure: copyTask.keepDirStructure,
802
+ destRoot: copyTask.dest
795
803
  }];
796
804
  }
805
+ /**
806
+ * Keeping the directory structure of a `src` outside `srcDir` (`../x`) would carry the `../`
807
+ * into the destination path.
808
+ *
809
+ * @param task a per-file copy task
810
+ * @returns `true` if the task would write outside its destination directory
811
+ */
812
+ function escapesDest({ dest, destRoot }) {
813
+ const rel = path.relative(destRoot, dest);
814
+ return rel.startsWith("..") || path.isAbsolute(rel);
815
+ }
797
816
  function getSrcAbsPath(srcDir, src) {
798
817
  if (path.isAbsolute(src)) return src;
799
818
  return path.join(srcDir, src);
@@ -812,17 +831,25 @@ function createGlobCopyTask(copyTask, srcDir, globRelPath) {
812
831
  dest,
813
832
  ignore: copyTask.ignore,
814
833
  warn: copyTask.warn,
815
- keepDirStructure: copyTask.keepDirStructure
834
+ keepDirStructure: copyTask.keepDirStructure,
835
+ destRoot: copyTask.dest
816
836
  };
817
837
  }
818
- async function processCopyTask(results, allCopyTasks, copyTask) {
838
+ const createDirectoryWalk = ({ src, ignore = [] }) => ({
839
+ root: src,
840
+ isIgnored: picomatch(ignore, {
841
+ dot: true,
842
+ nocase: true
843
+ })
844
+ });
845
+ async function processCopyTask(results, allCopyTasks, copyTask, walk) {
819
846
  try {
820
847
  copyTask.src = normalizePath(copyTask.src);
821
848
  copyTask.dest = normalizePath(copyTask.dest);
822
849
  if ((await stat(copyTask.src)).isDirectory()) {
823
850
  if (!results.dirPaths.includes(copyTask.dest)) results.dirPaths.push(copyTask.dest);
824
- await processCopyTaskDirectory(results, allCopyTasks, copyTask);
825
- } else if (!shouldIgnore(copyTask)) {
851
+ await processCopyTaskDirectory(results, allCopyTasks, copyTask, walk ?? createDirectoryWalk(copyTask));
852
+ } else if (!walk || !walk.isIgnored(path.posix.relative(walk.root, copyTask.src))) {
826
853
  if (!results.filePaths.includes(copyTask.dest)) results.filePaths.push(copyTask.dest);
827
854
  allCopyTasks.push(copyTask);
828
855
  }
@@ -833,7 +860,7 @@ async function processCopyTask(results, allCopyTasks, copyTask) {
833
860
  }
834
861
  }
835
862
  }
836
- async function processCopyTaskDirectory(results, allCopyTasks, copyTask) {
863
+ async function processCopyTaskDirectory(results, allCopyTasks, copyTask, walk) {
837
864
  try {
838
865
  const dirItems = await readdir(copyTask.src);
839
866
  await Promise.all(dirItems.map(async (dirItem) => {
@@ -841,7 +868,7 @@ async function processCopyTaskDirectory(results, allCopyTasks, copyTask) {
841
868
  src: path.join(copyTask.src, dirItem),
842
869
  dest: path.join(copyTask.dest, dirItem),
843
870
  warn: copyTask.warn
844
- });
871
+ }, walk);
845
872
  }));
846
873
  } catch (e) {
847
874
  catchError(results.diagnostics, e);
@@ -869,10 +896,6 @@ function addMkDir(mkDirs, destDir) {
869
896
  if (!mkDirs.includes(destDir)) mkDirs.push(destDir);
870
897
  }
871
898
  const ROOT_DIR = normalizePath(path.resolve("/"));
872
- function shouldIgnore({ src, ignore = [] }) {
873
- const filePath = src.trim().toLowerCase();
874
- return ignore.some((ignoreFile) => filePath.endsWith(ignoreFile));
875
- }
876
899
  function asyncGlob(pattern, opts = {}) {
877
900
  const { nodir, ...rest } = opts;
878
901
  return glob(pattern, {
@@ -1429,7 +1452,6 @@ function createNodeSys(c = {}) {
1429
1452
  opts.window.Request = global.Request;
1430
1453
  opts.window.Response = global.Response;
1431
1454
  },
1432
- fetch: global.fetch,
1433
1455
  checkVersion,
1434
1456
  copyFile(src, dst) {
1435
1457
  return new Promise((resolve) => {
@@ -1507,9 +1529,6 @@ function createNodeSys(c = {}) {
1507
1529
  getCompilerExecutingPath() {
1508
1530
  return compilerExecutingPath;
1509
1531
  },
1510
- getEnvironmentVar(key) {
1511
- return process.env[key];
1512
- },
1513
1532
  getLocalModulePath() {
1514
1533
  return null;
1515
1534
  },
@@ -1902,35 +1921,10 @@ function createNodeSys(c = {}) {
1902
1921
  totalmem: totalmem()
1903
1922
  }
1904
1923
  };
1905
- sys.lazyRequire = new NodeLazyRequire(new NodeResolveModule(), {
1906
- "@types/jest": {
1907
- minVersion: "24.9.1",
1908
- recommendedVersion: "29",
1909
- maxVersion: "29.0.0"
1910
- },
1911
- jest: {
1912
- minVersion: "24.9.0",
1913
- recommendedVersion: "29",
1914
- maxVersion: "29.0.0"
1915
- },
1916
- "jest-cli": {
1917
- minVersion: "24.9.0",
1918
- recommendedVersion: "29",
1919
- maxVersion: "29.0.0"
1920
- },
1921
- puppeteer: {
1922
- minVersion: "10.0.0",
1923
- recommendedVersion: "20"
1924
- },
1925
- "puppeteer-core": {
1926
- minVersion: "10.0.0",
1927
- recommendedVersion: "20"
1928
- },
1929
- "workbox-build": {
1930
- minVersion: "4.3.1",
1931
- recommendedVersion: "4.3.1"
1932
- }
1933
- });
1924
+ sys.lazyRequire = new NodeLazyRequire(new NodeResolveModule(), { "workbox-build": {
1925
+ minVersion: "4.3.1",
1926
+ recommendedVersion: "7"
1927
+ } });
1934
1928
  prcs.on("SIGINT", runInterruptsCallbacks);
1935
1929
  prcs.on("exit", runInterruptsCallbacks);
1936
1930
  return sys;